gau-workshop / app.py
RaphaelKalandadze's picture
Update app.py
065dcd1 verified
raw
history blame
1.04 kB
import gradio as gr
import requests
import json
url = "https://chat-engine-test.carleadsup.com/api/call/llm"
headers = {'Content-Type': 'application/json'}
def greet(text):
payload = {
"body": {
"token": "jshgduwygdhbwdb1234",
"messages": [
{"role": "system", "content": """แƒจแƒ”แƒœ แƒฎแƒแƒ  แƒ›แƒ”แƒ’แƒแƒ‘แƒ แƒฃแƒšแƒ˜ แƒแƒกแƒ˜แƒกแƒขแƒ”แƒœแƒขแƒ˜. แƒ›แƒ˜แƒžแƒแƒกแƒฃแƒฎแƒ” แƒงแƒแƒ•แƒ”แƒšแƒ—แƒ•แƒ˜แƒก แƒ˜แƒกแƒ” แƒ แƒแƒ› แƒ’แƒแƒ›แƒแƒ˜แƒงแƒ”แƒœแƒ แƒ”แƒ›แƒแƒฏแƒ˜แƒ”แƒ‘แƒ˜ (emoji) แƒ“แƒ แƒกแƒ›แƒแƒ˜แƒšแƒ”แƒ‘แƒ˜ (smile) โค๏ธ"""},
{"role": "user", "content": text}],
"model":"RaphaelKalandadze/test4",
"temperature": 0.4,
"max_tokens": 1024,
"frequency_penalty": 1.2,
}
}
response = requests.post(url, json=payload, headers=headers)
loaded = json.loads(response.json()["body"])["resp"]["content"]
return loaded
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()