Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -84,10 +84,11 @@ token = os.getenv("token")
|
|
84 |
tokenread = os.getenv("tokenread")
|
85 |
localdir = "HeadlinePrediction"
|
86 |
repo = Repository(local_dir=localdir, clone_from="https://huggingface.co/spaces/Add1E/HeadlinePrediction", token=token)
|
|
|
87 |
# Beispiel für die Verwendung der Funktiona
|
88 |
api_key = os.getenv("api_key") # Setzen Sie hier Ihren OpenAI-API-Schlüssel ein
|
89 |
st.title("Webseiten-Scraper")
|
90 |
-
base_prompt =
|
91 |
csv_name = "results.csv"
|
92 |
df = pd.read_csv(csv_name, encoding='utf-8')
|
93 |
df.columns = [col.replace(' ', '_') for col in df.columns]
|
@@ -101,24 +102,24 @@ if st.sidebar.button("Upload Data"):
|
|
101 |
repo.git_push()
|
102 |
|
103 |
|
104 |
-
auswahl = st.sidebar.selectbox("Wählen Sie eine Prediction:", ["None", "Prediction 1", "Prediction 2", "Prediction 3", "Prediction 4", "Prediction 5"])
|
105 |
-
random_numbers = set()
|
106 |
-
while len(random_numbers) < 5:
|
107 |
-
random_numbers.add(random.randint(0, len(df)-1))
|
108 |
|
109 |
-
random_numbers = list(random_numbers)
|
110 |
|
111 |
|
112 |
-
if auswahl == "Prediction 1":
|
113 |
-
st.dataframe(df.iloc[random_numbers[0]])
|
114 |
-
elif auswahl == "Prediction 2":
|
115 |
-
st.dataframe(df.iloc[random_numbers[1]])
|
116 |
-
elif auswahl == "Prediction 3":
|
117 |
-
st.dataframe(df.iloc[random_numbers[2]])
|
118 |
-
elif auswahl == "Prediction 4":
|
119 |
-
st.dataframe(df.iloc[random_numbers[3]])
|
120 |
-
elif auswahl == "Prediction 5":
|
121 |
-
st.dataframe(df.iloc[random_numbers[4]])
|
122 |
|
123 |
|
124 |
if st.sidebar.button("Show Full Data"):
|
|
|
84 |
tokenread = os.getenv("tokenread")
|
85 |
localdir = "HeadlinePrediction"
|
86 |
repo = Repository(local_dir=localdir, clone_from="https://huggingface.co/spaces/Add1E/HeadlinePrediction", token=token)
|
87 |
+
|
88 |
# Beispiel für die Verwendung der Funktiona
|
89 |
api_key = os.getenv("api_key") # Setzen Sie hier Ihren OpenAI-API-Schlüssel ein
|
90 |
st.title("Webseiten-Scraper")
|
91 |
+
base_prompt = os.getenv("prompt")
|
92 |
csv_name = "results.csv"
|
93 |
df = pd.read_csv(csv_name, encoding='utf-8')
|
94 |
df.columns = [col.replace(' ', '_') for col in df.columns]
|
|
|
102 |
repo.git_push()
|
103 |
|
104 |
|
105 |
+
#auswahl = st.sidebar.selectbox("Wählen Sie eine Prediction:", ["None", "Prediction 1", "Prediction 2", "Prediction 3", "Prediction 4", "Prediction 5"])
|
106 |
+
#random_numbers = set()
|
107 |
+
#while len(random_numbers) < 5:
|
108 |
+
# random_numbers.add(random.randint(0, len(df)-1))
|
109 |
|
110 |
+
#random_numbers = list(random_numbers)
|
111 |
|
112 |
|
113 |
+
#if auswahl == "Prediction 1":
|
114 |
+
# st.dataframe(df.iloc[random_numbers[0]])
|
115 |
+
#elif auswahl == "Prediction 2":
|
116 |
+
# st.dataframe(df.iloc[random_numbers[1]])
|
117 |
+
#elif auswahl == "Prediction 3":
|
118 |
+
# st.dataframe(df.iloc[random_numbers[2]])
|
119 |
+
#elif auswahl == "Prediction 4":
|
120 |
+
# st.dataframe(df.iloc[random_numbers[3]])
|
121 |
+
#elif auswahl == "Prediction 5":
|
122 |
+
# st.dataframe(df.iloc[random_numbers[4]])
|
123 |
|
124 |
|
125 |
if st.sidebar.button("Show Full Data"):
|