Spaces:
Sleeping
Sleeping
RaphaelKalandadze
commited on
Commit
•
8dfdbda
1
Parent(s):
66b77d4
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from openai import OpenAI
|
3 |
+
|
4 |
+
import requests
|
5 |
+
import json
|
6 |
+
|
7 |
+
|
8 |
+
url = "https://chat-engine-test.carleadsup.com/api/call/llm"
|
9 |
+
headers = {'Content-Type': 'application/json'}
|
10 |
+
|
11 |
+
def greet(text):
|
12 |
+
payload = {
|
13 |
+
"body": {
|
14 |
+
"token": "jshgduwygdhbwdb1234",
|
15 |
+
"messages": [
|
16 |
+
{"role": "system", "content": ""},
|
17 |
+
{"role": "user", "content": text}],
|
18 |
+
"model":"RaphaelKalandadze/test4",
|
19 |
+
"temperature": 0.4,
|
20 |
+
"max_tokens": 512,
|
21 |
+
"frequency_penalty": 1.2,
|
22 |
+
}
|
23 |
+
}
|
24 |
+
response = requests.post(url, json=payload, headers=headers)
|
25 |
+
loaded = json.loads(response.json()["body"])["resp"]["content"]
|
26 |
+
return loaded
|
27 |
+
|
28 |
+
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
29 |
+
demo.launch()
|