Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -542,22 +542,7 @@ def main():
|
|
| 542 |
with open('detailedResults.json','w') as fi:
|
| 543 |
#data = json.load(fi)
|
| 544 |
fi.write(json_data)
|
| 545 |
-
|
| 546 |
-
# # fi.seek(0)
|
| 547 |
-
# fi.write(json_data)
|
| 548 |
-
# fi.truncate()
|
| 549 |
-
# file_jso.truncate(0)
|
| 550 |
-
# file_jso.write(json_data)
|
| 551 |
-
# st.write('after',file_jso.read())
|
| 552 |
-
# file_jso.close()
|
| 553 |
-
# api.upload_file(
|
| 554 |
-
# path_or_fileobj=json_data,
|
| 555 |
-
# path_in_repo="ch.json",
|
| 556 |
-
# repo_id="Seetha/IMA-pipeline-streamlit",
|
| 557 |
-
# repo_type="dataset",
|
| 558 |
-
# token="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",
|
| 559 |
-
# )
|
| 560 |
-
#dataset = load_dataset('json', data_files='smalljson.json')
|
| 561 |
def convert_df(df):
|
| 562 |
|
| 563 |
#IMPORTANT: Cache the conversion to prevent computation on every rerun
|
|
@@ -571,84 +556,8 @@ def main():
|
|
| 571 |
|
| 572 |
with st.container():
|
| 573 |
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
#st.download_button(label="Download the detailed result table_csv",data=csv1,file_name='results.csv',mime='text/csv')
|
| 577 |
-
# st.download_button(label="Download the result table_csv",data=csv2,file_name='final_data.csv',mime='text/csv')
|
| 578 |
-
|
| 579 |
-
#st.download_button(label="Download the detailed result table",data=buffer,file_name="df_final.xlsx",mime="application/vnd.ms-excel")
|
| 580 |
st.download_button(label="Download the result table",data=buffer,file_name="t2cg_outputs.xlsx",mime="application/vnd.ms-excel")
|
| 581 |
|
| 582 |
-
# repo_dir = 'IMA-pipeline-streamlit'
|
| 583 |
-
# repo = Repo(repo_dir)
|
| 584 |
-
# file_list = [
|
| 585 |
-
# '/app/ima-pipeline-streamlit/results.csv',
|
| 586 |
-
# '/app/ima-pipeline-streamlit/final_data.csv'
|
| 587 |
-
# ]
|
| 588 |
-
# commit_message = 'Add the generated files to Github'
|
| 589 |
-
# repo.index.add(file_list)
|
| 590 |
-
# repo.index.commit(commit_message)
|
| 591 |
-
# origin = repo.remote('origin')
|
| 592 |
-
# origin.push()
|
| 593 |
-
|
| 594 |
-
# # LINK TO THE CSS FILE
|
| 595 |
-
# def tree_css(file_name):
|
| 596 |
-
# with open('tree.css')as f:
|
| 597 |
-
# st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html = True)
|
| 598 |
-
|
| 599 |
-
# def div_css(file_name):
|
| 600 |
-
# with open('div.css')as f:
|
| 601 |
-
# st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html = True)
|
| 602 |
-
|
| 603 |
-
# def side_css(file_name):
|
| 604 |
-
# with open('side.css')as f:
|
| 605 |
-
# st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html = True)
|
| 606 |
-
|
| 607 |
-
# tree_css('tree.css')
|
| 608 |
-
# div_css('div.css')
|
| 609 |
-
# side_css('side.css')
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
# STREAMLIT_STATIC_PATH = pathlib.Path(st.__path__[0]) / 'static'
|
| 613 |
-
# CSS_PATH = (STREAMLIT_STATIC_PATH / "css")
|
| 614 |
-
# if not CSS_PATH.is_dir():
|
| 615 |
-
# CSS_PATH.mkdir()
|
| 616 |
-
|
| 617 |
-
# # css_file = CSS_PATH / "tree.css"
|
| 618 |
-
# # css_file1 = CSS_PATH / "div.css"
|
| 619 |
-
# # css_file2 = CSS_PATH / "side.css"
|
| 620 |
-
# css_file2 = CSS_PATH / "ch.json"
|
| 621 |
-
# if not css_file2.exists():
|
| 622 |
-
# shutil.copy("css/ch.json", css_file2)
|
| 623 |
-
# shutil.copy("assets/css/tree.css", css_file)
|
| 624 |
-
# shutil.copy("assets/css/div.css", css_file1)
|
| 625 |
-
# shutil.copy("assets/css/side.css", css_file2)
|
| 626 |
-
# HtmlFile = open("index.html", 'r', encoding='utf-8')
|
| 627 |
-
# source_code = HtmlFile.read()
|
| 628 |
-
# #print(source_code)
|
| 629 |
-
# components.html(source_code)
|
| 630 |
-
# # # Define your javascript
|
| 631 |
-
# my_js = """
|
| 632 |
-
# alert("Hello World");
|
| 633 |
-
# """
|
| 634 |
-
|
| 635 |
-
# Wrapt the javascript as html code
|
| 636 |
-
#my_html = f"<script>{my_js}</script>"
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
# with st.container():
|
| 640 |
-
# # Execute your app
|
| 641 |
-
# st.title("Visualization example")
|
| 642 |
-
# # components.html(source_code)
|
| 643 |
-
# #html(my_html)
|
| 644 |
-
# #webbrowser.open('https://webpages.charlotte.edu/ltotapal/')
|
| 645 |
-
# # embed streamlit docs in a streamlit app
|
| 646 |
-
# #components.iframe("https://webpages.charlotte.edu/ltotapal/")
|
| 647 |
-
# st.markdown('<a href="https://webpages.charlotte.edu/ltotapal/" target="_self">Text to Knowledge graph link</a>', unsafe_allow_html=True)
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
|
| 653 |
if __name__ == '__main__':
|
| 654 |
main()
|
|
|
|
| 542 |
with open('detailedResults.json','w') as fi:
|
| 543 |
#data = json.load(fi)
|
| 544 |
fi.write(json_data)
|
| 545 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 546 |
def convert_df(df):
|
| 547 |
|
| 548 |
#IMPORTANT: Cache the conversion to prevent computation on every rerun
|
|
|
|
| 556 |
|
| 557 |
with st.container():
|
| 558 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 559 |
st.download_button(label="Download the result table",data=buffer,file_name="t2cg_outputs.xlsx",mime="application/vnd.ms-excel")
|
| 560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 561 |
|
| 562 |
if __name__ == '__main__':
|
| 563 |
main()
|