Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,18 +2,16 @@ import gradio as gr
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import os
|
4 |
import markdown
|
5 |
-
|
6 |
|
7 |
# Initialize the Hugging Face Inference Client
|
8 |
client = InferenceClient()
|
9 |
|
10 |
|
11 |
def render_latex(latex_input):
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
except Exception as e:
|
16 |
-
return f"{latex_input}"
|
17 |
|
18 |
# Function to generate and format AI response
|
19 |
def generate_response(prompt_template, **kwargs):
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import os
|
4 |
import markdown
|
5 |
+
import katex
|
6 |
|
7 |
# Initialize the Hugging Face Inference Client
|
8 |
client = InferenceClient()
|
9 |
|
10 |
|
11 |
def render_latex(latex_input):
|
12 |
+
rendered_html = katex.render(latex_input, display_mode=True)
|
13 |
+
return f"{rendered_html}"
|
14 |
+
|
|
|
|
|
15 |
|
16 |
# Function to generate and format AI response
|
17 |
def generate_response(prompt_template, **kwargs):
|