AV-AV commited on
Commit
9b61851
·
verified ·
1 Parent(s): b92f1df

Update app.py

Browse files

Made some cosmetic changes

Files changed (1) hide show
  1. app.py +18 -15
app.py CHANGED
@@ -47,8 +47,8 @@ For each parameter, rate the blog on a scale of 1 to 10 and provide **specific s
47
  - "FAQs"
48
  - "Top5 Suggestions"
49
  - "Edited Article"
50
- - "PreEditing GenAI Content%"
51
- - "PostEditing GenAI Content%"
52
 
53
  Ensure the output is formatted correctly for use with the Python `json` library.
54
  """
@@ -105,9 +105,9 @@ def process_all_parameters(article):
105
  reference_links = json.dumps(parsed_response.get('Reference Links', {}), indent=2)
106
  faqs = json.dumps(parsed_response.get('FAQs', {}), indent=2)
107
  top_suggestions = json.dumps(parsed_response.get('Top5 Suggestions', []), indent=2)
 
 
108
  edited_article = parsed_response.get('Edited Article', "No edited article found")
109
- pre_editing_genai = json.dumps(parsed_response.get('PreEditing GenAi Content%', {}), indent=2)
110
- post_editing_genai = json.dumps(parsed_response.get('PostEditing GenAi Content%', {}), indent=2)
111
 
112
  # Process highlighted response
113
  messages2 = [
@@ -117,13 +117,12 @@ def process_all_parameters(article):
117
 
118
  highlighted_response = agent(messages2)
119
 
120
- return (word_count, language_grammar, word_usage, flow_structure, technical_soundness,
121
- reference_links, faqs, top_suggestions, pre_editing_genai, post_editing_genai,
122
- edited_article, highlighted_response)
123
 
124
  # Gradio Interface
125
  with gr.Blocks() as demo:
126
- gr.Markdown("## AV Blog Editor V2")
127
  gr.Markdown("### Guidelines")
128
  gr.Markdown("""
129
  1. Use your discretion while using this tool.
@@ -132,8 +131,10 @@ with gr.Blocks() as demo:
132
  4. Do share any suggestions for improvements in this tool with Apoorv. You can get some candies for that :)
133
  """)
134
 
135
- article_input = gr.Textbox(label="Input Article", lines=15, placeholder="Enter your article here...")
136
 
 
 
137
  with gr.Row():
138
  with gr.Column():
139
  word_count = gr.Textbox(label="Word Count")
@@ -146,13 +147,15 @@ with gr.Blocks() as demo:
146
  reference_links = gr.Textbox(label="Reference Links", lines=3)
147
  faqs = gr.Textbox(label="FAQs", lines=3)
148
  top_suggestions = gr.Textbox(label="Top 5 Suggestions", lines=5)
149
- pre_editing_genai = gr.Textbox(label="PreEditing GenAI Content%", lines=1)
150
- post_editing_genai = gr.Textbox(label="PostEditing GenAI Content%", lines=1)
151
 
152
- gr.Markdown("### Edited Article")
153
- highlighted_response = gr.Markdown(label="Highlighted Response")
154
 
155
- submit_btn = gr.Button("Submit")
 
 
 
 
156
 
157
  # Handle everything in one go
158
  def process(article):
@@ -165,7 +168,7 @@ with gr.Blocks() as demo:
165
  outputs=[
166
  word_count, language_grammar, word_usage, flow_structure, technical_soundness,
167
  reference_links, faqs, top_suggestions, pre_editing_genai, post_editing_genai,
168
- gr.Textbox(label="Edited Article"), highlighted_response
169
  ]
170
  )
171
 
 
47
  - "FAQs"
48
  - "Top5 Suggestions"
49
  - "Edited Article"
50
+ - "PreEdit GenAI Perc"
51
+ - "PostEdit GenAI Perc"
52
 
53
  Ensure the output is formatted correctly for use with the Python `json` library.
54
  """
 
105
  reference_links = json.dumps(parsed_response.get('Reference Links', {}), indent=2)
106
  faqs = json.dumps(parsed_response.get('FAQs', {}), indent=2)
107
  top_suggestions = json.dumps(parsed_response.get('Top5 Suggestions', []), indent=2)
108
+ pre_editing_genai = json.dumps(parsed_response.get('PreEdit GenAI Perc', {}), indent=2)
109
+ post_editing_genai = json.dumps(parsed_response.get('PostEdit GenAI Perc', {}), indent=2)
110
  edited_article = parsed_response.get('Edited Article', "No edited article found")
 
 
111
 
112
  # Process highlighted response
113
  messages2 = [
 
117
 
118
  highlighted_response = agent(messages2)
119
 
120
+ return (word_count, language_grammar, word_usage, flow_structure, technical_soundness,reference_links,
121
+ faqs, top_suggestions, pre_editing_genai, post_editing_genai, edited_article, highlighted_response)
 
122
 
123
  # Gradio Interface
124
  with gr.Blocks() as demo:
125
+ gr.Markdown("## AV Blog Editor V3")
126
  gr.Markdown("### Guidelines")
127
  gr.Markdown("""
128
  1. Use your discretion while using this tool.
 
131
  4. Do share any suggestions for improvements in this tool with Apoorv. You can get some candies for that :)
132
  """)
133
 
134
+ article_input = gr.Textbox(label="Input Article", lines=12, placeholder="Enter your article here...")
135
 
136
+ submit_btn = gr.Button("Submit")
137
+
138
  with gr.Row():
139
  with gr.Column():
140
  word_count = gr.Textbox(label="Word Count")
 
147
  reference_links = gr.Textbox(label="Reference Links", lines=3)
148
  faqs = gr.Textbox(label="FAQs", lines=3)
149
  top_suggestions = gr.Textbox(label="Top 5 Suggestions", lines=5)
150
+ pre_editing_genai = gr.Textbox(label="PreEdit GenAI Perc", lines=1)
151
+ post_editing_genai = gr.Textbox(label="PostEdit GenAI Perc", lines=1)
152
 
 
 
153
 
154
+ gr.Markdown("### Edits Highlighted")
155
+ highlighted_response = gr.Markdown()
156
+
157
+ edited_article = gr.Textbox(label="Edited Article")
158
+
159
 
160
  # Handle everything in one go
161
  def process(article):
 
168
  outputs=[
169
  word_count, language_grammar, word_usage, flow_structure, technical_soundness,
170
  reference_links, faqs, top_suggestions, pre_editing_genai, post_editing_genai,
171
+ edited_article, highlighted_response
172
  ]
173
  )
174