rippertnt commited on
Commit
933bd45
1 Parent(s): 825c7c8

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +42 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+ import json
4
+
5
+
6
+ with open('config.json', 'r', encoding='utf-8') as file:
7
+ data = json.load(file)
8
+
9
+ print(data)
10
+
11
+ type = data['prompt']
12
+ introId = data['introId']
13
+ faceId = data['faceId']
14
+ voiceId = data['voiceId']
15
+
16
+ def chat(message, history):
17
+
18
+ txt = ""
19
+
20
+ print(message)
21
+ #r = requests.post('https://oe-napi.circul.us/v1/txt2chat', json = { "body" : {'prompt ': message, 'history' : [''], 'lang' : 'ko','type':'assist', 'rag' : '','temp' : 1}, 'prompt ': message, 'history' : [''], 'lang' : 'ko','type':'assist', 'rag' : '','temp' : 1}, stream=True)
22
+ r = requests.post('http://222.112.0.215:59522/v1/chat', json={ 'prompt': message, 'history' : [''], 'lang' : 'ko','type': type, 'rag' : '','temp' : 1 }, stream=True)
23
+
24
+ print(r)
25
+ for line in r.iter_lines():
26
+ line = line.decode('utf-8')
27
+ print(line)
28
+ txt = txt + "\n" + line
29
+ yield txt
30
+
31
+ desc = f"""
32
+ <video width="512" height="512" controls poster="https://canvers.net/v1/v/media/{faceId}" preload autoplay>
33
+ <source src="https://canvers.net/v1/v/media/{introId}?type=mp4" type="video/mp4">
34
+ </video>
35
+ """
36
+
37
+ # http://222.112.0.215:59522/v1/v/media/658aaf340833518cf6140dd8?type=mp4&length=158033
38
+
39
+ demo = gr.ChatInterface(fn=chat, description=desc, fill_height=True)
40
+
41
+ if __name__ == "__main__":
42
+ demo.launch()