enzostvs HF staff commited on
Commit
4ea2502
1 Parent(s): c443eac

title generation prompt updated

Browse files
app/api/generate/title/route.ts CHANGED
@@ -13,10 +13,12 @@ export async function POST(
13
  ['x-use-cache']: "0"
14
  },
15
  body: JSON.stringify({
16
- inputs: `Generate and return only a music title based on the following prompt: ${prompt}`,
 
17
  parameters: {
18
  num_return_sequences: 1,
19
- return_full_text: false
 
20
  }
21
  }),
22
  })
 
13
  ['x-use-cache']: "0"
14
  },
15
  body: JSON.stringify({
16
+ // inputs: `Generate and return only a music title based on the following prompt: ${prompt}`,
17
+ inputs: `Generate a music title based on the following prompt: ${prompt}, return only the title between quotes.`,
18
  parameters: {
19
  num_return_sequences: 1,
20
+ return_full_text: false,
21
+
22
  }
23
  }),
24
  })
components/form.tsx CHANGED
@@ -196,13 +196,13 @@ export const Form = ({ children }: { children: React.ReactNode }) => {
196
  ) : (
197
  <div className="w-[300px] h-[300px] bg-stone-900 animate-pulse rounded-xl mx-auto"></div>
198
  )}
199
- {/* {results.title ? (
200
  <p className="text-center text-white font-bold text-3xl">
201
  {results.title}
202
  </p>
203
  ) : (
204
  <div className="w-[450px] h-8 bg-stone-900 animate-pulse rounded-xl mx-auto"></div>
205
- )} */}
206
  {modelLoaded &&
207
  (track !== "" ? (
208
  <div className="mx-auto">
 
196
  ) : (
197
  <div className="w-[300px] h-[300px] bg-stone-900 animate-pulse rounded-xl mx-auto"></div>
198
  )}
199
+ {results.title ? (
200
  <p className="text-center text-white font-bold text-3xl">
201
  {results.title}
202
  </p>
203
  ) : (
204
  <div className="w-[450px] h-8 bg-stone-900 animate-pulse rounded-xl mx-auto"></div>
205
+ )}
206
  {modelLoaded &&
207
  (track !== "" ? (
208
  <div className="mx-auto">
components/hooks/useGeneration.ts CHANGED
@@ -54,21 +54,21 @@ export const useGeneration = () => {
54
  })
55
  })
56
 
57
- // fetch("/api/generate/title", {
58
- // method: "POST",
59
- // headers: {
60
- // "Content-Type": "application/json"
61
- // },
62
- // body: JSON.stringify({
63
- // prompt: form.prompt
64
- // })
65
- // }).then((res) => res.json())
66
- // .then((res: any) => {
67
- // new_results.title = res.title
68
- // setResults({
69
- // ...new_results,
70
- // })
71
- // })
72
  }
73
 
74
  const randomize = () => {
 
54
  })
55
  })
56
 
57
+ fetch("/api/generate/title", {
58
+ method: "POST",
59
+ headers: {
60
+ "Content-Type": "application/json"
61
+ },
62
+ body: JSON.stringify({
63
+ prompt: form.prompt
64
+ })
65
+ }).then((res) => res.json())
66
+ .then((res: any) => {
67
+ new_results.title = res.title
68
+ setResults({
69
+ ...new_results,
70
+ })
71
+ })
72
  }
73
 
74
  const randomize = () => {