AFischer1985 commited on
Commit
69717e0
·
verified ·
1 Parent(s): e0d9991

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -2,18 +2,22 @@ import gradio as gr
2
  import os, shutil, time
3
  from gradio_client import Client
4
  client = Client("ByteDance/Hyper-SDXL-1Step-T2I")
 
5
  def multimodalResponse(message,history):
6
- length=str(len(history))
7
  print(message)
8
  result = client.predict(
9
- num_images=1,
10
- height=1024,
11
- width=1024,
12
- prompt=message,
13
- seed=3413,
14
- api_name="/process_image")
15
  shutil.copy(result[0]['image'],os.getcwd())
16
- os.rename('image.webp', 'image'+length+'.webp')
17
  return "Prompt '"+message+"': ![image](/file="+os.getcwd()+"/image"+length+".webp)"
18
- i=gr.ChatInterface(multimodalResponse,multimodal=False)
19
- i.launch(allowed_paths=["."])
 
 
 
 
2
  import os, shutil, time
3
  from gradio_client import Client
4
  client = Client("ByteDance/Hyper-SDXL-1Step-T2I")
5
+ id=0
6
  def multimodalResponse(message,history):
7
+ id=id+1
8
  print(message)
9
  result = client.predict(
10
+ num_images=1,
11
+ height=1024,
12
+ width=1024,
13
+ prompt=message,
14
+ seed=3413,
15
+ api_name="/process_image")
16
  shutil.copy(result[0]['image'],os.getcwd())
17
+ os.rename('image.webp', 'image'+str(id)+'.webp')
18
  return "Prompt '"+message+"': ![image](/file="+os.getcwd()+"/image"+length+".webp)"
19
+ bot=gr.Chatbot(
20
+ value=[[None,"I'm a simple image-generating chatbot. Please tell me what you would like to see."]],
21
+ render_markdown=True)
22
+ interface=gr.ChatInterface(multimodalResponse,chatbot=bot, multimodal=False)
23
+ interface.launch(allowed_paths=["."])