tushar310 commited on
Commit
39625b7
·
verified ·
1 Parent(s): 4a3065e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -4,7 +4,7 @@ from groq import Groq
4
  import markdown
5
 
6
  # Retrieve system prompts from environment variables
7
- GENERATE_PROMPT = os.environ.get("system_prompt")
8
  HUMANIZE_PROMPT = os.environ.get("HUMANIZE_PROMPT")
9
 
10
  def generate_mba_content(topic, api_key):
@@ -71,25 +71,25 @@ def humanize_text(text, api_key):
71
  if 'client' in locals():
72
  del client
73
 
74
- # Define Gradio interface with tabs
75
  def gradio_app():
76
  with gr.Blocks(title="MBA Content Tools") as app:
77
  gr.Markdown("# MBA Content Tools")
78
- gr.Markdown("Generate or humanize content in MBA-style format.")
 
 
79
 
80
  with gr.Tab("Generate Content from Topic"):
81
  topic_input = gr.Textbox(label="Topic", placeholder="e.g., Strategic Management")
82
- api_key_gen = gr.Textbox(label="Groq API Key", type="password")
83
  generate_btn = gr.Button("Generate Content")
84
  generate_output = gr.Markdown(label="Generated Content")
85
- generate_btn.click(generate_mba_content, inputs=[topic_input, api_key_gen], outputs=generate_output)
86
 
87
  with gr.Tab("Humanize Existing Text"):
88
  text_input = gr.TextArea(label="Text to Humanize", placeholder="Paste your article, report, or paragraph here")
89
- api_key_hum = gr.Textbox(label="Groq API Key", type="password")
90
  humanize_btn = gr.Button("Humanize Text")
91
  humanize_output = gr.Markdown(label="Humanized Content")
92
- humanize_btn.click(humanize_text, inputs=[text_input, api_key_hum], outputs=humanize_output)
93
 
94
  gr.Markdown("""
95
  **Note:** Your API key is used securely for this session and cleared from memory afterward.
 
4
  import markdown
5
 
6
  # Retrieve system prompts from environment variables
7
+ GENERATE_PROMPT = os.environ.get("GENERATE_PROMPT")
8
  HUMANIZE_PROMPT = os.environ.get("HUMANIZE_PROMPT")
9
 
10
  def generate_mba_content(topic, api_key):
 
71
  if 'client' in locals():
72
  del client
73
 
74
+ # Define Gradio interface
75
  def gradio_app():
76
  with gr.Blocks(title="MBA Content Tools") as app:
77
  gr.Markdown("# MBA Content Tools")
78
+ gr.Markdown("Generate or humanize content in a professional MBA-style format.")
79
+
80
+ api_key_input = gr.Textbox(label="Groq API Key", type="password", placeholder="Enter your Groq API key here")
81
 
82
  with gr.Tab("Generate Content from Topic"):
83
  topic_input = gr.Textbox(label="Topic", placeholder="e.g., Strategic Management")
 
84
  generate_btn = gr.Button("Generate Content")
85
  generate_output = gr.Markdown(label="Generated Content")
86
+ generate_btn.click(generate_mba_content, inputs=[topic_input, api_key_input], outputs=generate_output)
87
 
88
  with gr.Tab("Humanize Existing Text"):
89
  text_input = gr.TextArea(label="Text to Humanize", placeholder="Paste your article, report, or paragraph here")
 
90
  humanize_btn = gr.Button("Humanize Text")
91
  humanize_output = gr.Markdown(label="Humanized Content")
92
+ humanize_btn.click(humanize_text, inputs=[text_input, api_key_input], outputs=humanize_output)
93
 
94
  gr.Markdown("""
95
  **Note:** Your API key is used securely for this session and cleared from memory afterward.