YKajima commited on
Commit
0d2e704
·
1 Parent(s): 2acf559

add twinroom api

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  import gradio as gr
2
  from spiralfilm import FilmCore, FilmConfig
3
 
@@ -40,8 +43,15 @@ async def summarize(input_text: str, input_url: str):
40
 
41
 
42
  async def chat(input_text, input_url):
43
- return await summarize(input_text, input_url)
44
-
 
 
 
 
 
 
 
45
 
46
  with gr.Blocks() as iface:
47
  # UI
 
1
+ import os
2
+ import json
3
+ import requests
4
  import gradio as gr
5
  from spiralfilm import FilmCore, FilmConfig
6
 
 
43
 
44
 
45
  async def chat(input_text, input_url):
46
+ summary = await summarize(input_text, input_url)
47
+ endpoint = os.environ.get("TWINROOM_API_BASE")
48
+ payload = {
49
+ "content": summary
50
+ }
51
+ headers = {'API-Key': os.environ.get("TWINROOM_API_KEY")}
52
+ json_payload = json.dumps(payload)
53
+ response = requests.post(endpoint, headers=headers, data=json_payload)
54
+ return response.text
55
 
56
  with gr.Blocks() as iface:
57
  # UI