Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
mf={
|
| 4 |
-
"Heading1":"#",
|
| 5 |
-
"Heading2":"##",
|
| 6 |
-
"Heading3":"###",
|
|
|
|
| 7 |
}
|
| 8 |
-
|
| 9 |
def upd(inp,format):
|
| 10 |
-
line=f'{mf[format]
|
| 11 |
return line
|
| 12 |
with gr.Blocks() as app:
|
| 13 |
format=gr.Dropdown(label="Line Format",choices=[m for m in list(mf.keys())])
|
| 14 |
txt=gr.Textbox()
|
| 15 |
btn=gr.Button()
|
| 16 |
-
prev=gr.Markdown("
|
| 17 |
btn.click(upd,[txt,format],prev)
|
| 18 |
app.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
mf={
|
| 4 |
+
"Heading1":"# $INP",
|
| 5 |
+
"Heading2":"## $INP",
|
| 6 |
+
"Heading3":"### $INP",
|
| 7 |
+
"Bold":"** $INP **"
|
| 8 |
}
|
|
|
|
| 9 |
def upd(inp,format):
|
| 10 |
+
line=f'{mf[format].replace("$INP",inp)}'
|
| 11 |
return line
|
| 12 |
with gr.Blocks() as app:
|
| 13 |
format=gr.Dropdown(label="Line Format",choices=[m for m in list(mf.keys())])
|
| 14 |
txt=gr.Textbox()
|
| 15 |
btn=gr.Button()
|
| 16 |
+
prev=gr.Markdown("")
|
| 17 |
btn.click(upd,[txt,format],prev)
|
| 18 |
app.launch()
|