Jofthomas HF staff commited on
Commit
f28c7ce
1 Parent(s): 9ecc7bb

Update TextGen/router.py

Browse files
Files changed (1) hide show
  1. TextGen/router.py +8 -2
TextGen/router.py CHANGED
@@ -2,12 +2,13 @@ import os
2
  import time
3
  from langchain_core.pydantic_v1 import BaseModel, Field
4
  from fastapi import FastAPI, HTTPException, Query, Request
5
- from fastapi.responses import StreamingResponse
6
  from fastapi.middleware.cors import CORSMiddleware
7
 
8
  from langchain.chains import LLMChain
9
  from langchain.prompts import PromptTemplate
10
  from TextGen.suno import custom_generate_audio, get_audio_information,generate_lyrics
 
11
  from coqui import predict
12
  from langchain_google_genai import (
13
  ChatGoogleGenerativeAI,
@@ -229,4 +230,9 @@ async def generate_song():
229
 
230
  })
231
  infos=get_audio_information(f"{data[0]['id']},{data[1]['id']}")
232
- return infos
 
 
 
 
 
 
2
  import time
3
  from langchain_core.pydantic_v1 import BaseModel, Field
4
  from fastapi import FastAPI, HTTPException, Query, Request
5
+ from fastapi.responses import StreamingResponse,Response
6
  from fastapi.middleware.cors import CORSMiddleware
7
 
8
  from langchain.chains import LLMChain
9
  from langchain.prompts import PromptTemplate
10
  from TextGen.suno import custom_generate_audio, get_audio_information,generate_lyrics
11
+ from TextGen.diffusion import generate_image
12
  from coqui import predict
13
  from langchain_google_genai import (
14
  ChatGoogleGenerativeAI,
 
230
 
231
  })
232
  infos=get_audio_information(f"{data[0]['id']},{data[1]['id']}")
233
+ return infos
234
+
235
+ @app.post('/generate_image')
236
+ def Imagen(prompt):
237
+ image_bytes=generate_image(prompt)
238
+ return Response(content=image_bytes, media_type="image/png")