raannakasturi commited on
Commit
ba88ce0
·
verified ·
1 Parent(s): 8b1dfdc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -46
app.py CHANGED
@@ -1,47 +1,47 @@
1
- import gradio as gr
2
- from generate_svg import main
3
-
4
- theme = gr.themes.Soft(
5
- primary_hue="purple",
6
- secondary_hue="cyan",
7
- neutral_hue="slate",
8
- font=[
9
- gr.themes.GoogleFont("Syne"),
10
- gr.themes.GoogleFont("Poppins"),
11
- gr.themes.GoogleFont("Poppins"),
12
- gr.themes.GoogleFont("Poppins")
13
- ],
14
- )
15
-
16
- with gr.Blocks(theme=theme, title="MarkDown SVG Generator", fill_height=True) as app:
17
- gr.HTML(
18
- value ="""
19
- <h1 style="text-align: center;">MarkDown SVG Generator<p style="text-align: center;">Designed and Developed by <a href="https://raannakasturi.eu.org" target="_blank" rel="nofollow noreferrer external">Nayan Kasturi</a></p> </h1>
20
- <p style="text-align: center;">MarkDown SVG Generator for ReXplore</p>
21
- """)
22
- with gr.Row():
23
- with gr.Column():
24
- markdown = gr.Textbox(label="Markdown Text", placeholder="Enter the markdown text", lines=7)
25
- get_file = gr.Button(value="SVG File", variant="primary")
26
- svg_viewer = gr.Textbox(label="SVG Viewer", placeholder="SVG Viewer", lines=7, interactive=False, show_copy_button=True)
27
- get_file.click(
28
- main,
29
- inputs=[markdown],
30
- outputs=[svg_viewer],
31
- concurrency_limit=25,
32
- scroll_to_output=True,
33
- show_api=True,
34
- api_name="markdown_svg_generator",
35
- show_progress="full",
36
- )
37
-
38
- import subprocess
39
- try:
40
- subprocess.run(["apt", "update"], check=True)
41
- subprocess.run(["apt" "install" "graphviz"], check=True)
42
- app.queue(default_concurrency_limit=25).launch(show_api=True, show_error=True, debug=True)
43
- except subprocess.CalledProcessError:
44
- print("Graphviz is not installed. Please install it using `apt install graphviz` and try again.")
45
- except Exception as e:
46
- print(f"An error occurred: {e}")
47
  raise e
 
1
+ import gradio as gr
2
+ from generate_svg import main
3
+
4
+ theme = gr.themes.Soft(
5
+ primary_hue="purple",
6
+ secondary_hue="cyan",
7
+ neutral_hue="slate",
8
+ font=[
9
+ gr.themes.GoogleFont("Syne"),
10
+ gr.themes.GoogleFont("Poppins"),
11
+ gr.themes.GoogleFont("Poppins"),
12
+ gr.themes.GoogleFont("Poppins")
13
+ ],
14
+ )
15
+
16
+ with gr.Blocks(theme=theme, title="MarkDown SVG Generator", fill_height=True) as app:
17
+ gr.HTML(
18
+ value ="""
19
+ <h1 style="text-align: center;">MarkDown SVG Generator<p style="text-align: center;">Designed and Developed by <a href="https://raannakasturi.eu.org" target="_blank" rel="nofollow noreferrer external">Nayan Kasturi</a></p> </h1>
20
+ <p style="text-align: center;">MarkDown SVG Generator for ReXplore</p>
21
+ """)
22
+ with gr.Row():
23
+ with gr.Column():
24
+ markdown = gr.Textbox(label="Markdown Text", placeholder="Enter the markdown text", lines=7)
25
+ get_file = gr.Button(value="SVG File", variant="primary")
26
+ svg_viewer = gr.Textbox(label="SVG Viewer", placeholder="SVG Viewer", lines=7, interactive=False, show_copy_button=True)
27
+ get_file.click(
28
+ main,
29
+ inputs=[markdown],
30
+ outputs=[svg_viewer],
31
+ concurrency_limit=25,
32
+ scroll_to_output=True,
33
+ show_api=True,
34
+ api_name="markdown_svg_generator",
35
+ show_progress="full",
36
+ )
37
+
38
+ import subprocess
39
+ try:
40
+ subprocess.run(["apt", "update"], check=True)
41
+ subprocess.run(["apt", "install", "graphviz"], check=True)
42
+ app.queue(default_concurrency_limit=25).launch(show_api=True, show_error=True, debug=True)
43
+ except subprocess.CalledProcessError:
44
+ print("Graphviz is not installed. Please install it using `apt install graphviz` and try again.")
45
+ except Exception as e:
46
+ print(f"An error occurred: {e}")
47
  raise e