Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,18 +19,6 @@ openai.api_key = os.environ.get('openai-api')
|
|
| 19 |
# Blocks
|
| 20 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
| 21 |
|
| 22 |
-
def main():
|
| 23 |
-
credentials = get_credentials()
|
| 24 |
-
http = credentials.authorize(Http())
|
| 25 |
-
docs_service = discovery.build(
|
| 26 |
-
'docs', 'v1', http=http, discoveryServiceUrl=DISCOVERY_DOC)
|
| 27 |
-
doc = docs_service.documents().get(documentId=DOCUMENT_ID).execute()
|
| 28 |
-
doc_content = doc.get('body').get('content')
|
| 29 |
-
docsread = read_structural_elements(doc_content)
|
| 30 |
-
|
| 31 |
-
if __name__ == '__main__':
|
| 32 |
-
main()
|
| 33 |
-
|
| 34 |
def get_credentials():
|
| 35 |
"""Gets valid user credentials from storage.
|
| 36 |
|
|
@@ -48,6 +36,18 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
|
| 48 |
credentials = tools.run_flow(flow, store)
|
| 49 |
return credentials
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
def read_paragraph_element(element):
|
| 52 |
"""Returns the text in the given ParagraphElement.
|
| 53 |
|
|
|
|
| 19 |
# Blocks
|
| 20 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
def get_credentials():
|
| 23 |
"""Gets valid user credentials from storage.
|
| 24 |
|
|
|
|
| 36 |
credentials = tools.run_flow(flow, store)
|
| 37 |
return credentials
|
| 38 |
|
| 39 |
+
def main():
|
| 40 |
+
credentials = get_credentials()
|
| 41 |
+
http = credentials.authorize(Http())
|
| 42 |
+
docs_service = discovery.build(
|
| 43 |
+
'docs', 'v1', http=http, discoveryServiceUrl=DISCOVERY_DOC)
|
| 44 |
+
doc = docs_service.documents().get(documentId=DOCUMENT_ID).execute()
|
| 45 |
+
doc_content = doc.get('body').get('content')
|
| 46 |
+
docsread = read_structural_elements(doc_content)
|
| 47 |
+
|
| 48 |
+
if __name__ == '__main__':
|
| 49 |
+
main()
|
| 50 |
+
|
| 51 |
def read_paragraph_element(element):
|
| 52 |
"""Returns the text in the given ParagraphElement.
|
| 53 |
|