Spaces:
Runtime error
Runtime error
Create backup.app.py
Browse files- backup.app.py +124 -0
backup.app.py
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# List of URLs provided by the user
|
2 |
+
urls = [
|
3 |
+
"https://huggingface.co/spaces/awacke1/CB-GR-Chatbot-Blenderbot",
|
4 |
+
"https://huggingface.co/spaces/awacke1/TTS-STT-Blocks",
|
5 |
+
"https://huggingface.co/spaces/awacke1/Prompt-Refinery-Text-to-Image-Generation",
|
6 |
+
"https://huggingface.co/spaces/awacke1/Video-Summary",
|
7 |
+
"https://huggingface.co/spaces/awacke1/AI-MovieMaker-Comedy",
|
8 |
+
"https://huggingface.co/spaces/awacke1/ChatGPT-Memory-Chat-Story-Generator",
|
9 |
+
"https://huggingface.co/spaces/awacke1/CloneAnyVoice",
|
10 |
+
"https://huggingface.co/spaces/awacke1/ChatGPT-Streamlit-2",
|
11 |
+
"https://huggingface.co/spaces/awacke1/WikipediaUltimateAISearch",
|
12 |
+
"https://huggingface.co/spaces/awacke1/RLHF.Cognitive.Episodic.Semantic.Memory",
|
13 |
+
"https://huggingface.co/spaces/awacke1/Memory-Shared",
|
14 |
+
"https://huggingface.co/spaces/awacke1/VideoSwap",
|
15 |
+
"https://huggingface.co/spaces/awacke1/AI-Wikipedia-Search",
|
16 |
+
"https://huggingface.co/spaces/awacke1/AutoMLUsingStreamlit-Plotly",
|
17 |
+
"https://huggingface.co/spaces/awacke1/NLP-Lyric-Chorus-Image",
|
18 |
+
"https://huggingface.co/spaces/awacke1/OpenAssistant-Chatbot-FTW-Open-Source",
|
19 |
+
"https://huggingface.co/spaces/awacke1/ChatGPTStreamlit7",
|
20 |
+
"https://huggingface.co/spaces/awacke1/MultiPDF-QA-ChatGPT-Langchain",
|
21 |
+
"https://huggingface.co/spaces/awacke1/SOTA-Plan",
|
22 |
+
"https://huggingface.co/spaces/awacke1/AIandSmartTools",
|
23 |
+
"https://huggingface.co/spaces/awacke1/3DVirtualFood",
|
24 |
+
"https://huggingface.co/spaces/awacke1/Gradio-Gallery-Health-Medical-Icon-Sets",
|
25 |
+
"https://huggingface.co/spaces/awacke1/DatasetAnalyzer",
|
26 |
+
"https://huggingface.co/spaces/awacke1/PrompTart",
|
27 |
+
"https://huggingface.co/spaces/awacke1/sileod-deberta-v3-base-tasksource-nli",
|
28 |
+
"https://huggingface.co/spaces/awacke1/File-Memory-Operations-Human-Feedback-Gradio",
|
29 |
+
"https://huggingface.co/spaces/awacke1/Bloom.Big.Science.Continual.Generator",
|
30 |
+
"https://huggingface.co/spaces/awacke1/Ontology-Gradio",
|
31 |
+
"https://huggingface.co/spaces/awacke1/HTML5-Aframe-3dMap-Flight",
|
32 |
+
"https://huggingface.co/spaces/awacke1/Bloom.Generative.Writer",
|
33 |
+
"https://huggingface.co/spaces/awacke1/Voice-ChatGPT-Streamlit-12",
|
34 |
+
"https://huggingface.co/spaces/awacke1/HTML5-AR-VR",
|
35 |
+
"https://huggingface.co/spaces/awacke1/AnimationAI",
|
36 |
+
"https://huggingface.co/spaces/awacke1/GenerativeWordsandImages",
|
37 |
+
"https://huggingface.co/spaces/awacke1/AR-VR-IOT-Demo",
|
38 |
+
"https://huggingface.co/spaces/awacke1/ArtStyleFoodsandNutrition",
|
39 |
+
"https://huggingface.co/spaces/awacke1/CarePlanQnAWithContext",
|
40 |
+
"https://huggingface.co/spaces/awacke1/VideoSummaryYoutube3",
|
41 |
+
"https://huggingface.co/spaces/awacke1/AW-01ST-CSV-Dataset-Analyzer",
|
42 |
+
"https://huggingface.co/spaces/awacke1/Try.Playing.Learning.Sharing.On.This",
|
43 |
+
"https://huggingface.co/spaces/awacke1/google-flan-t5-base",
|
44 |
+
"https://huggingface.co/spaces/awacke1/PubMed-Parrot-Paraphraser-on-T5",
|
45 |
+
"https://huggingface.co/spaces/awacke1/Writing-Grammar-And-Paraphrase-w-Pegasus",
|
46 |
+
"https://huggingface.co/spaces/awacke1/runwayml-stable-diffusion-v1-5",
|
47 |
+
"https://huggingface.co/spaces/awacke1/DockerGoFlanT5",
|
48 |
+
"https://huggingface.co/spaces/awacke1/GradioContinualGenerator",
|
49 |
+
"https://huggingface.co/spaces/awacke1/StreamlitSuperPowerCheatSheet"
|
50 |
+
]
|
51 |
+
|
52 |
+
# Extract the last part of each URL (after the last '/') to serve as the name of the button
|
53 |
+
url_names = [url.split('/')[-1] for url in urls]
|
54 |
+
|
55 |
+
# Associate each URL with a relevant emoji based on keywords in its name
|
56 |
+
emoji_mapping = {
|
57 |
+
"Chatbot": "π€",
|
58 |
+
"TTS": "π£οΈ",
|
59 |
+
"STT": "π",
|
60 |
+
"Video": "π₯",
|
61 |
+
"MovieMaker": "πΏ",
|
62 |
+
"ChatGPT": "π¬",
|
63 |
+
"Voice": "ποΈ",
|
64 |
+
"Wikipedia": "π",
|
65 |
+
"Memory": "π§ ",
|
66 |
+
"AI": "π§ ",
|
67 |
+
"OpenAssistant": "π€",
|
68 |
+
"3D": "πΆοΈ",
|
69 |
+
"AR": "π",
|
70 |
+
"VR": "πΆοΈ",
|
71 |
+
"Animation": "ποΈ",
|
72 |
+
"Dataset": "π",
|
73 |
+
"Gradio": "π»",
|
74 |
+
"HTML5": "π",
|
75 |
+
"Writing": "βοΈ",
|
76 |
+
"Grammar": "ποΈ",
|
77 |
+
"Paraphrase": "π",
|
78 |
+
"Streamlit": "π "
|
79 |
+
}
|
80 |
+
|
81 |
+
# Map each URL name to its most relevant emoji
|
82 |
+
url_emojis = []
|
83 |
+
for name in url_names:
|
84 |
+
associated_emoji = "π" # Default emoji
|
85 |
+
for keyword, emoji in emoji_mapping.items():
|
86 |
+
if keyword in name:
|
87 |
+
associated_emoji = emoji
|
88 |
+
break
|
89 |
+
url_emojis.append(associated_emoji)
|
90 |
+
|
91 |
+
url_emojis[:5], url_names[:5] # Display the first 5 URL names with their associated emojis
|
92 |
+
|
93 |
+
import streamlit as st
|
94 |
+
import json
|
95 |
+
import webbrowser
|
96 |
+
|
97 |
+
# Function to load the history of clicks from the text file
|
98 |
+
def load_history():
|
99 |
+
try:
|
100 |
+
with open("click_history.txt", "r") as f:
|
101 |
+
return json.load(f)
|
102 |
+
except FileNotFoundError:
|
103 |
+
return {url: 0 for url in urls}
|
104 |
+
|
105 |
+
# Function to save the updated history of clicks to the text file
|
106 |
+
def save_history(history):
|
107 |
+
with open("click_history.txt", "w") as f:
|
108 |
+
json.dump(history, f)
|
109 |
+
|
110 |
+
# Load the history of clicks
|
111 |
+
history = load_history()
|
112 |
+
|
113 |
+
# Display the buttons for each URL
|
114 |
+
for url, name, emoji in zip(urls, url_names, url_emojis):
|
115 |
+
if st.button(f"{emoji} {name}"):
|
116 |
+
# Open the URL in a new browser tab using JavaScript
|
117 |
+
st.write('<script>window.open("'+url+'", "_blank");</script>', unsafe_allow_html=True)
|
118 |
+
# Update the history of clicks
|
119 |
+
history[url] += 1
|
120 |
+
save_history(history)
|
121 |
+
# Display the number of times the URL was opened below its corresponding button
|
122 |
+
st.write(f"Clicked: {history[url]} times")
|
123 |
+
|
124 |
+
|