Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,8 @@ import numpy as np
|
|
10 |
import streamlit as st
|
11 |
from openai import OpenAI
|
12 |
import os
|
13 |
-
import sys
|
14 |
from dotenv import load_dotenv
|
|
|
15 |
|
16 |
load_dotenv()
|
17 |
|
@@ -101,21 +101,24 @@ if task_choice == "Data Generation":
|
|
101 |
]
|
102 |
else:
|
103 |
few_shot_examples = []
|
104 |
-
|
105 |
# Ask the user how many examples they need
|
106 |
num_to_generate = st.number_input("How many examples to generate?", min_value=1, max_value=50, value=10)
|
107 |
|
|
|
|
|
|
|
108 |
# System prompt generation
|
109 |
system_prompt = f"You are a professional {classification_type.lower()} expert. Your role is to generate data for {domain}.\n\n"
|
110 |
if few_shot_examples:
|
111 |
system_prompt += "Use the following few-shot examples as a reference:\n"
|
112 |
for example in few_shot_examples:
|
113 |
system_prompt += f"Example: {example['content']} \n Label: {example['label']}\n"
|
114 |
-
system_prompt += f"Generate {num_to_generate} examples.\n"
|
115 |
system_prompt += f"Each example should have between {min_words} and {max_words} words.\n"
|
116 |
-
system_prompt +=
|
117 |
-
|
118 |
-
|
119 |
|
120 |
st.write("System Prompt:")
|
121 |
st.code(system_prompt)
|
@@ -149,3 +152,4 @@ else:
|
|
149 |
# Data labeling workflow (for future implementation based on classification)
|
150 |
st.write("Data Labeling functionality will go here.")
|
151 |
|
|
|
|
10 |
import streamlit as st
|
11 |
from openai import OpenAI
|
12 |
import os
|
|
|
13 |
from dotenv import load_dotenv
|
14 |
+
import random
|
15 |
|
16 |
load_dotenv()
|
17 |
|
|
|
101 |
]
|
102 |
else:
|
103 |
few_shot_examples = []
|
104 |
+
|
105 |
# Ask the user how many examples they need
|
106 |
num_to_generate = st.number_input("How many examples to generate?", min_value=1, max_value=50, value=10)
|
107 |
|
108 |
+
# User prompt text field
|
109 |
+
user_prompt = st.text_area("Enter your prompt to guide example generation", "")
|
110 |
+
|
111 |
# System prompt generation
|
112 |
system_prompt = f"You are a professional {classification_type.lower()} expert. Your role is to generate data for {domain}.\n\n"
|
113 |
if few_shot_examples:
|
114 |
system_prompt += "Use the following few-shot examples as a reference:\n"
|
115 |
for example in few_shot_examples:
|
116 |
system_prompt += f"Example: {example['content']} \n Label: {example['label']}\n"
|
117 |
+
system_prompt += f"Generate {num_to_generate} unique examples with diverse phrasing.\n"
|
118 |
system_prompt += f"Each example should have between {min_words} and {max_words} words.\n"
|
119 |
+
system_prompt += f"Use the labels specified: {', '.join(labels)}.\n"
|
120 |
+
if user_prompt:
|
121 |
+
system_prompt += f"Additional instructions: {user_prompt}\n"
|
122 |
|
123 |
st.write("System Prompt:")
|
124 |
st.code(system_prompt)
|
|
|
152 |
# Data labeling workflow (for future implementation based on classification)
|
153 |
st.write("Data Labeling functionality will go here.")
|
154 |
|
155 |
+
|