Akshayram1 commited on
Commit
6a143de
·
verified ·
1 Parent(s): 9f30434

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -85,10 +85,11 @@ def human_feedback(entities: Dict):
85
  # Generate JSON Output
86
  def generate_json_output(entities: Dict) -> str:
87
  output_path = "resume_entities.json"
 
88
  with open(output_path, 'w') as f:
89
- json.dump(entities, f, indent=4)
90
  st.write(f"Output saved as {output_path}")
91
- return output_path
92
 
93
  # Main function to orchestrate workflow
94
  def main():
@@ -122,8 +123,10 @@ def main():
122
  st.write("Final entities:", entities)
123
 
124
  # Generate JSON output
125
- json_path = generate_json_output(entities)
126
- st.download_button("Download JSON Output", file_name=json_path)
 
 
127
 
128
  # Streamlit app entry point
129
  if __name__ == "__main__":
 
85
  # Generate JSON Output
86
  def generate_json_output(entities: Dict) -> str:
87
  output_path = "resume_entities.json"
88
+ json_data = json.dumps(entities, indent=4) # Create JSON string from the entities dictionary
89
  with open(output_path, 'w') as f:
90
+ f.write(json_data)
91
  st.write(f"Output saved as {output_path}")
92
+ return json_data # Return the JSON data instead of file path
93
 
94
  # Main function to orchestrate workflow
95
  def main():
 
123
  st.write("Final entities:", entities)
124
 
125
  # Generate JSON output
126
+ json_data = generate_json_output(entities) # Use JSON data instead of file path
127
+
128
+ # Pass the JSON data to st.download_button
129
+ st.download_button("Download JSON Output", data=json_data, file_name="resume_entities.json")
130
 
131
  # Streamlit app entry point
132
  if __name__ == "__main__":