File size: 1,142 Bytes
42548f2
d4febae
312de82
d4febae
 
 
 
 
 
df46f1b
312de82
42548f2
d4febae
 
 
 
312de82
d4febae
df46f1b
312de82
df46f1b
 
 
d4febae
da1838e
df46f1b
 
d4febae
df46f1b
d4febae
 
 
 
312de82
 
 
d4febae
 
 
 
 
 
 
 
 
 
e781b23
d4febae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { gradioDoc } from "./gradioDoc.mts"

export function getGradioApp(prompt: string) {
  const prefix = "# In app.py:\n```"

  const instructions = [
    {
      role: "system",
      content: [
        `You are a Python developer, expert at crafting Gradio applications to deploy to Hugging Face. You must generate valid Python code. Don't forget the requirements.txt files!`,
        `Here is an example of a minimal Gradio application:`,
        gradioDoc
      ].filter(item => item).join("\n")
    },
    {
      role: "user",
      content: `Please write, file by file, the source code for a Gradio project.

You MUST use the following Python modules:
- gradio (version 3.39.0)

You are free to use (if necessary) the following Python modules:
- numpy
- matplotlib
- pytorch
- diffusers
- transformers

Don't forget to write a README.md with the following header, or else you will be FIRED:
\`\`\`
---
license: apache-2.0
title: <app name>
sdk: gradio
sdk_version: 3.39.0
app_file: app.py
emoji: πŸ‘€
colorFrom: green
colorTo: blue
---
\`\`\`

The app is about: ${prompt}`,
    }
  ]

  return { prefix, files: [], instructions }
}