Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import streamlit as st
|
3 |
+
from prompt_runner import run_prompt
|
4 |
+
from prompt_evaluator import evaluate_qa, evaluate_summarization, evaluate_ner
|
5 |
+
import os
|
6 |
+
from dotenv import load_dotenv
|
7 |
+
|
8 |
+
load_dotenv()
|
9 |
+
|
10 |
+
st.set_page_config(page_title="OrbIQ Prompt Playground", layout="wide")
|
11 |
+
|
12 |
+
st.title("🤖 OrbIQ – Prompt Engineering Sandbox")
|
13 |
+
|
14 |
+
task = st.selectbox("Choose a Task", ["QA (Few-shot)", "Summarization", "NER"])
|
15 |
+
|
16 |
+
input_text = st.text_area("Enter your input text here:", height=150)
|
17 |
+
|
18 |
+
examples = [
|
19 |
+
{"question": "Who wrote Hamlet?", "answer": "William Shakespeare"},
|
20 |
+
{"question": "What is the capital of France?", "answer": "Paris"}
|
21 |
+
]
|
22 |
+
|
23 |
+
if st.button("Run Prompt"):
|
24 |
+
if task == "QA (Few-shot)":
|
25 |
+
output = run_prompt("qa_few_shot", input_text, examples)
|
26 |
+
st.subheader("LLM Answer")
|
27 |
+
st.write(output)
|
28 |
+
elif task == "Summarization":
|
29 |
+
output = run_prompt("summarization_instruction", input_text)
|
30 |
+
st.subheader("LLM Summary")
|
31 |
+
st.write(output)
|
32 |
+
elif task == "NER":
|
33 |
+
output = run_prompt("ner_prompt", input_text)
|
34 |
+
st.subheader("LLM Output")
|
35 |
+
st.text(output)
|
36 |
+
else:
|
37 |
+
st.warning("Unsupported task")
|
38 |
+
|
39 |
+
st.success("Done!")
|