Mbonea commited on
Commit
aa314ad
β€’
1 Parent(s): 1990e29
App/Generate/generatorRoutes.py CHANGED
@@ -28,11 +28,10 @@ async def main(request: GeneratorRequest):
28
  Prompt.format(topic=topic)
29
  + f"Match your response to the following schema: {VideoOutput.model_json_schema()} Make sure to return an instance of the JSON, not the schema itself, and nothing else."
30
  )
31
- message = json.loads(temp.split("```json")[1].split("```")[0].strip())
32
  generated_story = Story.from_dict(message["scenes"])
33
 
34
  print("Generated Story βœ…")
35
-
36
  x = await Project.objects.create(name=topic[0:100])
37
 
38
  # Assuming generated_story.scenes is a list of scenes
 
28
  Prompt.format(topic=topic)
29
  + f"Match your response to the following schema: {VideoOutput.model_json_schema()} Make sure to return an instance of the JSON, not the schema itself, and nothing else."
30
  )
31
+ message = temp
32
  generated_story = Story.from_dict(message["scenes"])
33
 
34
  print("Generated Story βœ…")
 
35
  x = await Project.objects.create(name=topic[0:100])
36
 
37
  # Assuming generated_story.scenes is a list of scenes
App/Generate/utils/HuggingChat.py CHANGED
@@ -5,7 +5,7 @@ import re
5
 
6
  class Hugging:
7
  def __init__(self):
8
- self.url = "https://p01--hugging--legal-stuff--a96n-7tyr.code.run/generate"
9
  self.headers = {
10
  "Authorization": "Bearer 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",
11
  "accept": "application/json",
@@ -20,6 +20,5 @@ class Hugging:
20
  async with session.post(
21
  self.url, headers=self.headers, data=json.dumps(payload)
22
  ) as response:
23
- result = await response.text()
24
- print(result)
25
  return result
 
5
 
6
  class Hugging:
7
  def __init__(self):
8
+ self.url = "http://127.0.0.1:8001/generate"
9
  self.headers = {
10
  "Authorization": "Bearer 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",
11
  "accept": "application/json",
 
20
  async with session.post(
21
  self.url, headers=self.headers, data=json.dumps(payload)
22
  ) as response:
23
+ result = await response.json()
 
24
  return result