Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,8 @@ def main():
|
|
21 |
store = file.Storage("credentials.json")
|
22 |
creds = store.get()
|
23 |
if not creds or creds.invalid:
|
24 |
-
|
|
|
25 |
creds = tools.run_flow(flow, store)
|
26 |
form_service = discovery.build("forms", "v1", http=creds.authorize(Http()))
|
27 |
|
@@ -43,16 +44,12 @@ def main():
|
|
43 |
if st.button("Generate Quiz"):
|
44 |
with st.spinner("Transcribing audio to generate the quiz..."):
|
45 |
transcribed_text = transcribe("audio.wav")
|
46 |
-
#
|
47 |
-
|
48 |
-
|
49 |
quiz_url = generate_quiz_url(transcribed_text, form_service)
|
50 |
st.success("Quiz generated successfully!")
|
51 |
st.text("Quiz Link: " + quiz_url)
|
52 |
st.text("Transcribed Text:\n" + transcribed_text)
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
if __name__ == '__main__':
|
58 |
main()
|
|
|
21 |
store = file.Storage("credentials.json")
|
22 |
creds = store.get()
|
23 |
if not creds or creds.invalid:
|
24 |
+
# If the credentials are invalid or not present, initiate the authentication flow
|
25 |
+
flow = client.flow_from_clientsecrets("client_secret_535279977482-vc7fo2d86o7uq3qnl05epg9l6sv6a6s1.apps.googleusercontent.com.json", SCOPES)
|
26 |
creds = tools.run_flow(flow, store)
|
27 |
form_service = discovery.build("forms", "v1", http=creds.authorize(Http()))
|
28 |
|
|
|
44 |
if st.button("Generate Quiz"):
|
45 |
with st.spinner("Transcribing audio to generate the quiz..."):
|
46 |
transcribed_text = transcribe("audio.wav")
|
47 |
+
# Generate the quiz URL based on the transcribed text and form service
|
|
|
|
|
48 |
quiz_url = generate_quiz_url(transcribed_text, form_service)
|
49 |
st.success("Quiz generated successfully!")
|
50 |
st.text("Quiz Link: " + quiz_url)
|
51 |
st.text("Transcribed Text:\n" + transcribed_text)
|
52 |
|
53 |
+
|
|
|
|
|
54 |
if __name__ == '__main__':
|
55 |
main()
|