Skip to content

Commit

Permalink
frontend receives data instead of random gibberish
Browse files Browse the repository at this point in the history
  • Loading branch information
raghav2005 committed Jan 28, 2024
1 parent 39489e8 commit c13a7d6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ firestore-debug.log
ui-debug.log
ServiceAccountKey.json
firebase-debug.log
functions/__pycache__/main.cpython-311.pyc
Binary file modified functions/__pycache__/main.cpython-311.pyc
Binary file not shown.
Binary file removed functions/__pycache__/settings.cpython-311.pyc
Binary file not shown.
6 changes: 4 additions & 2 deletions functions/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# generate story from inputs and return json of story & character descriptions
@https_fn.on_request()
def generate_story(req: https_fn.Request) -> https_fn.Response:
def generate_story(req: https_fn.Request) -> str:
data = req.get_json()
text = data.get("text")
theme = data.get("theme")
Expand Down Expand Up @@ -82,7 +82,7 @@ def generate_story(req: https_fn.Request) -> https_fn.Response:
print("db_doc:", db_doc)
response_object["document_id"] = db_doc[1].id

return https_fn.Response(response_object)
return str(response_object)


# generate character descriptions from story
Expand Down Expand Up @@ -119,3 +119,5 @@ def generate_narration(req: https_fn.Request) -> https_fn.Response:
blob.upload_from_string(audio_data, content_type="audio/mpeg")

print("Audio file successfully uploaded to firebase storage")

return https_fn.Response()

0 comments on commit c13a7d6

Please sign in to comment.