SpyC0der77 commited on
Commit
401f757
·
verified ·
1 Parent(s): a180f58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,9 +1,8 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import os
4
- client = InferenceClient("EvanZhouDev/open-genmoji", token=os.getenv("HUGGINGFACE_API_TOKEN"))
5
 
6
- # output is a PIL.Image object
7
 
8
  # Define the process function that takes a text prompt and returns an image
9
  def process(prompt):
@@ -21,7 +20,10 @@ with gr.Blocks() as demo:
21
 
22
  # Define the event listener for the button click
23
  generate_button.click(fn=process, inputs=prompt_input, outputs=image_output)
 
 
 
24
 
25
  # Launch the interface
26
  if __name__ == "__main__":
27
- demo.launch()
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import os
 
4
 
5
+ client = InferenceClient("EvanZhouDev/open-genmoji", token=os.getenv("HUGGINGFACE_API_TOKEN"))
6
 
7
  # Define the process function that takes a text prompt and returns an image
8
  def process(prompt):
 
20
 
21
  # Define the event listener for the button click
22
  generate_button.click(fn=process, inputs=prompt_input, outputs=image_output)
23
+
24
+ # Define the event listener for the Enter key press
25
+ prompt_input.submit(fn=process, inputs=prompt_input, outputs=image_output)
26
 
27
  # Launch the interface
28
  if __name__ == "__main__":
29
+ demo.launch(show_error=True)