Fancy-MLLM commited on
Commit
db07883
·
verified ·
1 Parent(s): 19ba654

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -36
app.py CHANGED
@@ -62,7 +62,28 @@ def generate_output(image, text, button_click):
62
  print(f"Error: {e}")
63
  yield f"Error occurred: {str(e)}"
64
 
65
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  gr.HTML("""<center><font size=8>🦖 R1-OneVision Demo</center>""")
67
 
68
  with gr.Row():
@@ -74,41 +95,7 @@ with gr.Blocks() as demo:
74
  submit_btn = gr.Button("Submit", variant="primary")
75
 
76
  with gr.Column():
77
- output_text = gr.Markdown(
78
- label="Generated Response",
79
- max_height="80vh",
80
- min_height="50vh",
81
- container=True,
82
- latex_delimiters=[{
83
- "left": "\\(",
84
- "right": "\\)",
85
- "display": True
86
- }, {
87
- "left": "\\begin\{equation\}",
88
- "right": "\\end\{equation\}",
89
- "display": True
90
- }, {
91
- "left": "\\begin\{align\}",
92
- "right": "\\end\{align\}",
93
- "display": True
94
- }, {
95
- "left": "\\begin\{alignat\}",
96
- "right": "\\end\{alignat\}",
97
- "display": True
98
- }, {
99
- "left": "\\begin\{gather\}",
100
- "right": "\\end\{gather\}",
101
- "display": True
102
- }, {
103
- "left": "\\begin\{CD\}",
104
- "right": "\\end\{CD\}",
105
- "display": True
106
- }, {
107
- "left": "\\[",
108
- "right": "\\]",
109
- "display": True
110
- }],
111
- elem_id="qwen-md")
112
 
113
  submit_btn.click(fn=generate_output, inputs=[input_image, input_text], outputs=output_text)
114
 
 
62
  print(f"Error: {e}")
63
  yield f"Error occurred: {str(e)}"
64
 
65
+ Css = """
66
+ #output-markdown {
67
+ overflow-y: auto;
68
+ white-space: pre-wrap;
69
+ word-wrap: break-word;
70
+ }
71
+
72
+ #output-markdown .math {
73
+ overflow-x: auto;
74
+ max-width: 100%;
75
+ }
76
+ .markdown-text {
77
+ white-space: pre-wrap;
78
+ word-wrap: break-word;
79
+ }
80
+ #qwen-md .katex-display { display: inline; }
81
+ #qwen-md .katex-display>.katex { display: inline; }
82
+ #qwen-md .katex-display>.katex>.katex-html { display: inline; }
83
+ """
84
+
85
+
86
+ with gr.Blocks(css=Css) as demo:
87
  gr.HTML("""<center><font size=8>🦖 R1-OneVision Demo</center>""")
88
 
89
  with gr.Row():
 
95
  submit_btn = gr.Button("Submit", variant="primary")
96
 
97
  with gr.Column():
98
+ output_text = gr.Markdown(elem_id="qwen-md", container=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
  submit_btn.click(fn=generate_output, inputs=[input_image, input_text], outputs=output_text)
101