Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 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)
|