-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
34 lines (23 loc) · 763 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import requests
import json
import gradio as gr
from src.constent import *
histroy = []
def generate_response(prompt):
histroy.append(prompt)
final_prompt = "\n".join( histroy)
data = {
"model": "LokiLogic",
"prompt": final_prompt,
"stream": False
}
response = requests.post(url,headers=headers, data=json.dumps(data))
if response.status_code == 200:
response=response.text
data=json.loads(response)
actual_response=data['response']
return actual_response
else:
print("error:",response.text)
interface = gr.Interface(fn = generate_response,inputs=gr.Textbox(lines=4,placeholder="Hi am LokiLogic, How can I help you !!"), outputs="text")
interface.launch()