measmonysuon commited on
Commit
c6bfa94
1 Parent(s): 57c37dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -50,7 +50,19 @@ def gradio_interface(prompt, resolution_key):
50
  return None, "There was an error processing your photo. Please try again later."
51
 
52
  def create_gradio_interface(username):
53
- with gr.Blocks() as interface:
 
 
 
 
 
 
 
 
 
 
 
 
54
  gr.HTML(f"""
55
  <script src="https://telegram.org/js/telegram-web-app.js"></script>
56
  <script>
@@ -62,16 +74,6 @@ def create_gradio_interface(username):
62
  <h3>Welcome, {username}! Generate images based on prompts.</h3>
63
  """)
64
 
65
- prompt_input = gr.Textbox(label="Prompt", placeholder="Enter your prompt here...")
66
- resolution_dropdown = gr.Dropdown(choices=list(resolutions.keys()), label="Resolution", value="1024x1024")
67
- generate_button = gr.Button("Generate")
68
-
69
- result_output = gr.Image(label="Generated Image", type="pil")
70
- message_output = gr.Textbox(label="Result", placeholder="Results will be shown here", interactive=False)
71
-
72
- generate_button.click(fn=lambda prompt, resolution_key: gradio_interface(prompt, resolution_key),
73
- inputs=[prompt_input, resolution_dropdown],
74
- outputs=[result_output, message_output])
75
 
76
  gr.HTML("""
77
  <style>
 
50
  return None, "There was an error processing your photo. Please try again later."
51
 
52
  def create_gradio_interface(username):
53
+ prompt_input = gr.Textbox(label="Prompt", placeholder="Enter your prompt here...")
54
+ resolution_dropdown = gr.Dropdown(choices=list(resolutions.keys()), label="Resolution", value="1024x1024")
55
+ generate_button = gr.Button("Generate")
56
+
57
+ result_output = gr.Image(label="Generated Image", type="pil")
58
+ message_output = gr.Textbox(label="Result", placeholder="Results will be shown here", interactive=False)
59
+
60
+ generate_button.click(fn=lambda prompt, resolution_key: gradio_interface(prompt, resolution_key),
61
+ inputs=[prompt_input, resolution_dropdown],
62
+ outputs=[result_output, message_output])
63
+
64
+
65
+ with gr.Blocks() as interface:
66
  gr.HTML(f"""
67
  <script src="https://telegram.org/js/telegram-web-app.js"></script>
68
  <script>
 
74
  <h3>Welcome, {username}! Generate images based on prompts.</h3>
75
  """)
76
 
 
 
 
 
 
 
 
 
 
 
77
 
78
  gr.HTML("""
79
  <style>