Update app.py
Browse files
app.py
CHANGED
@@ -152,11 +152,10 @@ def run_inference_and_analysis(task, system_prompt, input_text, temperature, top
|
|
152 |
# Gradio interface
|
153 |
def gradio_interface():
|
154 |
with gr.Blocks(theme=gr.themes.Base(), title="Prompt Engineering and LLM Studio") as demo:
|
155 |
-
gr.
|
156 |
"""
|
157 |
<div style="margin-bottom: 20px;">
|
158 |
<img src="https://raw.githubusercontent.com/pixeltable/pixeltable/main/docs/source/data/pixeltable-logo-large.png" alt="Pixeltable" style="max-width: 150px;" />
|
159 |
-
<h2>Text and Image similarity search on video frames with embedding indexes</h2>
|
160 |
</div>
|
161 |
"""
|
162 |
)
|
@@ -257,21 +256,6 @@ def gradio_interface():
|
|
257 |
],
|
258 |
wrap=True
|
259 |
)
|
260 |
-
|
261 |
-
# Define the examples
|
262 |
-
examples = [
|
263 |
-
# Example 1: Sentiment Analysis
|
264 |
-
["Sentiment Analysis",
|
265 |
-
"You are an AI trained to analyze the sentiment of text. Provide a detailed analysis of the emotional tone, highlighting key phrases that indicate sentiment.",
|
266 |
-
"The new restaurant downtown exceeded all my expectations. The food was exquisite, the service impeccable, and the ambiance was perfect for a romantic evening. I can't wait to go back!",
|
267 |
-
0.3, 0.95, 200, None, "", None, False],
|
268 |
-
|
269 |
-
# Example 2: Creative Writing
|
270 |
-
["Story Generation",
|
271 |
-
"You are a creative writer. Generate a short, engaging story based on the given prompt. Include vivid descriptions and an unexpected twist.",
|
272 |
-
"In a world where dreams are shared, a young girl discovers she can manipulate other people's dreams.",
|
273 |
-
0.9, 0.8, 500, 200, "The end.", None, False]
|
274 |
-
]
|
275 |
|
276 |
with gr.Column():
|
277 |
omn_response = gr.Textbox(label="Open-Mistral-Nemo Response")
|
@@ -288,13 +272,28 @@ def gradio_interface():
|
|
288 |
with gr.Row():
|
289 |
large_readability = gr.Number(label="Mistral-Medium Readability")
|
290 |
open_readability = gr.Number(label="Open-Mistral-Nemo Readability")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
|
292 |
gr.Examples(
|
293 |
examples=examples,
|
294 |
inputs=[task, system_prompt, input_text, temperature, top_p, max_tokens, min_tokens, stop, random_seed, safe_prompt],
|
295 |
outputs=[omn_response, ml_response, large_sentiment, open_sentiment, large_keywords, open_keywords, large_readability, open_readability],
|
296 |
fn=run_inference_and_analysis,
|
297 |
-
cache_examples=
|
298 |
)
|
299 |
|
300 |
gr.Markdown(
|
|
|
152 |
# Gradio interface
|
153 |
def gradio_interface():
|
154 |
with gr.Blocks(theme=gr.themes.Base(), title="Prompt Engineering and LLM Studio") as demo:
|
155 |
+
gr.HTML(
|
156 |
"""
|
157 |
<div style="margin-bottom: 20px;">
|
158 |
<img src="https://raw.githubusercontent.com/pixeltable/pixeltable/main/docs/source/data/pixeltable-logo-large.png" alt="Pixeltable" style="max-width: 150px;" />
|
|
|
159 |
</div>
|
160 |
"""
|
161 |
)
|
|
|
256 |
],
|
257 |
wrap=True
|
258 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
|
260 |
with gr.Column():
|
261 |
omn_response = gr.Textbox(label="Open-Mistral-Nemo Response")
|
|
|
272 |
with gr.Row():
|
273 |
large_readability = gr.Number(label="Mistral-Medium Readability")
|
274 |
open_readability = gr.Number(label="Open-Mistral-Nemo Readability")
|
275 |
+
|
276 |
+
# Define the examples
|
277 |
+
examples = [
|
278 |
+
# Example 1: Sentiment Analysis
|
279 |
+
["Sentiment Analysis",
|
280 |
+
"You are an AI trained to analyze the sentiment of text. Provide a detailed analysis of the emotional tone, highlighting key phrases that indicate sentiment.",
|
281 |
+
"The new restaurant downtown exceeded all my expectations. The food was exquisite, the service impeccable, and the ambiance was perfect for a romantic evening. I can't wait to go back!",
|
282 |
+
0.3, 0.95, 200, None, "", None, False],
|
283 |
+
|
284 |
+
# Example 2: Creative Writing
|
285 |
+
["Story Generation",
|
286 |
+
"You are a creative writer. Generate a short, engaging story based on the given prompt. Include vivid descriptions and an unexpected twist.",
|
287 |
+
"In a world where dreams are shared, a young girl discovers she can manipulate other people's dreams.",
|
288 |
+
0.9, 0.8, 500, 200, "The end.", None, False]
|
289 |
+
]
|
290 |
|
291 |
gr.Examples(
|
292 |
examples=examples,
|
293 |
inputs=[task, system_prompt, input_text, temperature, top_p, max_tokens, min_tokens, stop, random_seed, safe_prompt],
|
294 |
outputs=[omn_response, ml_response, large_sentiment, open_sentiment, large_keywords, open_keywords, large_readability, open_readability],
|
295 |
fn=run_inference_and_analysis,
|
296 |
+
cache_examples=False,
|
297 |
)
|
298 |
|
299 |
gr.Markdown(
|