Adam-Ben-Khalifa
commited on
Commit
•
7a623cb
1
Parent(s):
48d7c91
Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,7 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
13 |
# client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
14 |
|
15 |
|
16 |
-
async def advancedPromptPipeline(InputPrompt):
|
17 |
-
|
18 |
-
model="gpt-4o-mini"
|
19 |
|
20 |
if model == "gpt-4o":
|
21 |
i_cost=5/10**6
|
@@ -24,7 +22,7 @@ async def advancedPromptPipeline(InputPrompt):
|
|
24 |
i_cost=0.15/10**6
|
25 |
o_cost=0.6/10**6
|
26 |
|
27 |
-
enhancer = PromptEnhancer(model)
|
28 |
|
29 |
start_time = time.time()
|
30 |
advanced_prompt = await enhancer.enhance_prompt(InputPrompt, perform_eval=False)
|
@@ -93,10 +91,11 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
|
|
93 |
|
94 |
demo = gr.Interface(fn=advancedPromptPipeline,
|
95 |
inputs=[
|
96 |
-
gr.Textbox(
|
97 |
-
gr.
|
|
|
98 |
],
|
99 |
-
outputs=[gr.Textbox(label="Advanced Prompt"
|
100 |
|
101 |
|
102 |
if __name__ == "__main__":
|
|
|
13 |
# client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
14 |
|
15 |
|
16 |
+
async def advancedPromptPipeline(InputPrompt, model="gpt-4o-mini", temperature=0.0):
|
|
|
|
|
17 |
|
18 |
if model == "gpt-4o":
|
19 |
i_cost=5/10**6
|
|
|
22 |
i_cost=0.15/10**6
|
23 |
o_cost=0.6/10**6
|
24 |
|
25 |
+
enhancer = PromptEnhancer(model, temperature)
|
26 |
|
27 |
start_time = time.time()
|
28 |
advanced_prompt = await enhancer.enhance_prompt(InputPrompt, perform_eval=False)
|
|
|
91 |
|
92 |
demo = gr.Interface(fn=advancedPromptPipeline,
|
93 |
inputs=[
|
94 |
+
gr.Textbox(lines=20, placeholder="Enter your prompt", label="Input Prompt"),
|
95 |
+
gr.Radio(["gpt-4o-mini", "gpt-4o"], value="gpt-4o-mini", label="Select Model"),
|
96 |
+
gr.Slider(minimum=0.0, maximum=1.0, value=0.0, step=0.1, label="Temperature")
|
97 |
],
|
98 |
+
outputs=[gr.Textbox(lines=30, label="Advanced Prompt")])
|
99 |
|
100 |
|
101 |
if __name__ == "__main__":
|