bai4578 commited on
Commit
0253d61
·
verified ·
1 Parent(s): 791ee79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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
- # contentt = parse_text_to_dict(contentt)
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 = parse_text_to_dict(contentt)
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(prompts.keys()), # Get dictionary keys as choices
368
  label="Select Text Generation Type",
369
- value=list(prompts.keys())[0] # Default to the first key
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