techspace / app.py
tamunaZur's picture
Update app.py
f8a993f verified
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":
"""แƒฌแƒแƒ แƒ›แƒแƒ˜แƒ“แƒ’แƒ˜แƒœแƒ” แƒจแƒ”แƒœ แƒฎแƒแƒ  แƒ›แƒแƒกแƒฌแƒแƒ•แƒšแƒ”แƒ‘แƒ”แƒšแƒ˜, แƒจแƒ”แƒœแƒ˜ แƒแƒ›แƒแƒชแƒแƒœแƒแƒ แƒจแƒ”แƒแƒ“แƒ’แƒ˜แƒœแƒ แƒ™แƒ˜แƒ—แƒฎแƒ•แƒ แƒžแƒแƒกแƒฃแƒฎแƒ”แƒ‘แƒ˜ แƒ›แƒแƒชแƒ”แƒ›แƒฃแƒš แƒขแƒ”แƒฅแƒกแƒขแƒ–แƒ” แƒ“แƒแƒงแƒ แƒ“แƒœแƒแƒ‘แƒ˜แƒ—.
แƒงแƒแƒ•แƒ”แƒš แƒ™แƒ˜แƒ—แƒฎแƒ•แƒแƒก แƒฃแƒœแƒ“แƒ แƒฐแƒฅแƒแƒœแƒ“แƒ”แƒก 4 แƒกแƒแƒ•แƒแƒ แƒแƒฃแƒ“แƒ แƒแƒ แƒฉแƒ”แƒ•แƒ˜แƒ—แƒ˜ แƒžแƒแƒกแƒฃแƒฎแƒ”แƒ‘แƒ˜.
แƒ“แƒแƒ˜แƒ›แƒแƒฎแƒกแƒแƒ•แƒ แƒ” แƒงแƒแƒ•แƒ”แƒšแƒ—แƒ•แƒ˜แƒก แƒฌแƒ”แƒ แƒ” แƒฅแƒแƒ แƒ—แƒฃแƒšแƒแƒ“
"""},
{"role": "user", "content": text}],
"model":"RaphaelKalandadze/test4",
"temperature": 0.4,
"max_tokens": 512,
"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()