File size: 1,395 Bytes
8dfdbda
 
 
 
 
 
 
 
 
 
 
 
 
0b636a7
6cda757
0b636a7
8dfdbda
 
 
11a66c9
8dfdbda
 
 
 
 
 
 
 
 
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
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": """แƒจแƒ”แƒœ แƒฎแƒแƒ  แƒกแƒ™แƒแƒšแƒ˜แƒก แƒ›แƒแƒกแƒฌแƒแƒ•แƒšแƒ”แƒ‘แƒ”แƒšแƒ˜ แƒ“แƒ แƒจแƒ”แƒœแƒ˜ แƒแƒ›แƒแƒชแƒแƒœแƒแƒ แƒจแƒ”แƒแƒ“แƒ’แƒ˜แƒœแƒ แƒขแƒ”แƒกแƒขแƒ”แƒ‘แƒ˜ แƒ“แƒ แƒ™แƒ˜แƒ—แƒฎแƒ•แƒ”แƒ‘แƒ˜ แƒ›แƒฎแƒแƒšแƒแƒ“ แƒ›แƒแƒชแƒ”แƒ›แƒฃแƒš แƒขแƒ”แƒฅแƒกแƒขแƒ–แƒ” แƒ“แƒแƒงแƒ แƒ“แƒœแƒแƒ‘แƒ˜แƒ—.
แƒ“แƒแƒฌแƒ”แƒ แƒ” 3 แƒ™แƒ˜แƒ—แƒฎแƒ•แƒ แƒ›แƒแƒชแƒ”แƒ›แƒฃแƒšแƒ˜ แƒขแƒ”แƒฅแƒกแƒขแƒ˜แƒ“แƒแƒœ. แƒ—แƒ˜แƒ—แƒแƒ”แƒš แƒ™แƒ˜แƒ—แƒฎแƒ•แƒแƒก แƒฃแƒœแƒ“แƒ แƒฐแƒฅแƒแƒœแƒ“แƒ”แƒก แƒ แƒแƒ›แƒ“แƒ”แƒœแƒ˜แƒ›แƒ” แƒกแƒแƒ•แƒแƒ แƒแƒฃแƒ“แƒ แƒžแƒแƒกแƒฃแƒฎแƒ˜.
แƒแƒ  แƒ“แƒแƒ›แƒ˜แƒฌแƒ”แƒ แƒ แƒกแƒฌแƒแƒ แƒ˜ แƒžแƒแƒกแƒฃแƒฎแƒ”แƒ‘แƒ˜"""},
                {"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()