adpro commited on
Commit
7e0ed7b
·
verified ·
1 Parent(s): 91cd72d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -25
app.py CHANGED
@@ -13,33 +13,30 @@ def run_lora(prompt):
13
  print (re.split(":(?=http)",link["href"].replace("/url?q=","")))
14
  mLink+=str(re.split(":(?=http)",link["href"].replace("/url?q=","")))
15
  return mLink
16
- css = '''
17
- #gen_btn{height: 100%}
18
- #title{text-align: center}
19
- #title h1{font-size: 3em; display:inline-flex; align-items:center}
20
- #title img{width: 100px; margin-right: 0.5em}
21
- #gallery .grid-wrap{height: 10vh}
22
- '''
23
- with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
24
- title = gr.HTML(
25
- """<h1><img src="https://huggingface.co/spaces/multimodalart/flux-lora-the-explorer/resolve/main/flux_lora.png" alt="LoRA"> FLUX LoRA the Explorer</h1>""",
26
- elem_id="title",
27
- )
28
- selected_index = gr.State(None)
 
29
  with gr.Row():
30
- with gr.Column(scale=3):
31
- prompt = gr.Textbox(label="Prompt", lines=1, placeholder="Type a prompt after selecting a LoRA")
32
- with gr.Column(scale=1, elem_id="gen_column"):
33
- generate_button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
34
- with gr.Column(scale=1, elem_id="gen_column1"):
35
  translated_textbox = gr.Textbox(lines=5, placeholder="", label="Translated Text")
36
-
37
- gr.on(
38
- triggers=[generate_button.click, prompt.submit],
39
- fn=run_lora,
40
- inputs=[prompt],
41
- outputs=[translated_textbox]
42
- )
43
 
44
  app.queue()
45
  app.launch()
 
13
  print (re.split(":(?=http)",link["href"].replace("/url?q=","")))
14
  mLink+=str(re.split(":(?=http)",link["href"].replace("/url?q=","")))
15
  return mLink
16
+
17
+ with gr.Blocks() as demo:
18
+ gr.HTML("""<html>
19
+ <head>
20
+ <style>
21
+ h1 {
22
+ text-align: center;
23
+ }
24
+ </style>
25
+ </head>
26
+ <body>
27
+ <h1>Open Translate</h1>
28
+ </body>
29
+ </html>""")
30
  with gr.Row():
31
+ with gr.Column():
32
+
33
+ input_textbox = gr.Textbox(lines=5, placeholder="Enter text to translate", label="Input Text")
34
+ with gr.Column():
35
+
36
  translated_textbox = gr.Textbox(lines=5, placeholder="", label="Translated Text")
37
+ info_label = gr.HTML("")
38
+ btn = gr.Button("GetNow")
39
+ btn.click(translate, inputs=[prompt,outputs=[translated_textbox, info_label])
 
 
 
 
40
 
41
  app.queue()
42
  app.launch()