Update app.py
Browse files
app.py
CHANGED
|
@@ -273,7 +273,7 @@ def parse_text_to_dict(text):
|
|
| 273 |
with open("primpts.txt", "r", encoding="utf-8") as file:
|
| 274 |
contentt = file.read()
|
| 275 |
|
| 276 |
-
|
| 277 |
|
| 278 |
|
| 279 |
|
|
@@ -281,7 +281,7 @@ def generate_text(text, prompt_type):
|
|
| 281 |
if not text:
|
| 282 |
return "No text provided."
|
| 283 |
|
| 284 |
-
prompts =
|
| 285 |
|
| 286 |
selected_prompt = prompts.get(prompt_type, "You are a helpful assistant. Process the following text.")
|
| 287 |
|
|
@@ -364,9 +364,9 @@ with gr.Blocks(title="Audio Recorder, Transcriber, and Text Generator") as demo:
|
|
| 364 |
|
| 365 |
with gr.Row():
|
| 366 |
prompt_type = gr.Dropdown(
|
| 367 |
-
choices=list(
|
| 368 |
label="Select Text Generation Type",
|
| 369 |
-
value=list(
|
| 370 |
)
|
| 371 |
generate_btn = gr.Button("Generate Text")
|
| 372 |
|
|
|
|
| 273 |
with open("primpts.txt", "r", encoding="utf-8") as file:
|
| 274 |
contentt = file.read()
|
| 275 |
|
| 276 |
+
contentt = parse_text_to_dict(contentt)
|
| 277 |
|
| 278 |
|
| 279 |
|
|
|
|
| 281 |
if not text:
|
| 282 |
return "No text provided."
|
| 283 |
|
| 284 |
+
prompts = contentt
|
| 285 |
|
| 286 |
selected_prompt = prompts.get(prompt_type, "You are a helpful assistant. Process the following text.")
|
| 287 |
|
|
|
|
| 364 |
|
| 365 |
with gr.Row():
|
| 366 |
prompt_type = gr.Dropdown(
|
| 367 |
+
choices=list(contentt.keys()), # Get dictionary keys as choices
|
| 368 |
label="Select Text Generation Type",
|
| 369 |
+
value=list(contentt.keys())[0] # Default to the first key
|
| 370 |
)
|
| 371 |
generate_btn = gr.Button("Generate Text")
|
| 372 |
|