Upshivam commited on
Commit
f049c71
·
1 Parent(s): de4702d

Switch to free HF Inference API - no API key needed

Browse files
Files changed (1) hide show
  1. app.py +11 -16
app.py CHANGED
@@ -1,27 +1,22 @@
1
  import gradio as gr
2
- import anthropic
3
 
4
- client = anthropic.Anthropic()
5
 
6
  def generate_dockerfile(description, base_os, app_type):
7
- prompt = f"""You are a DevOps expert. Generate a production-ready Dockerfile for:
8
  Description: {description}
9
  Base OS: {base_os}
10
  App Type: {app_type}
 
 
11
 
12
- Include:
13
- - Multi-stage build if applicable
14
- - Non-root user for security
15
- - Health check
16
- - Clear comments
17
- Only return the Dockerfile content, nothing else."""
18
-
19
- message = client.messages.create(
20
- model="claude-opus-4-5",
21
- max_tokens=1024,
22
- messages=[{"role": "user", "content": prompt}]
23
  )
24
- return message.content[0].text
25
 
26
  demo = gr.Interface(
27
  fn=generate_dockerfile,
@@ -32,7 +27,7 @@ demo = gr.Interface(
32
  ],
33
  outputs=gr.Code(language="dockerfile", label="Generated Dockerfile"),
34
  title="🐳 DevOps Dockerfile Generator",
35
- description="Generate production-ready Dockerfiles instantly!"
36
  )
37
 
38
  demo.launch()
 
1
  import gradio as gr
2
+ from huggingface_hub import InferenceClient
3
 
4
+ client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.3")
5
 
6
  def generate_dockerfile(description, base_os, app_type):
7
+ prompt = f"""You are a DevOps expert. Generate a production-ready Dockerfile ONLY for:
8
  Description: {description}
9
  Base OS: {base_os}
10
  App Type: {app_type}
11
+ Include multi-stage build, non-root user, health check, comments.
12
+ Return ONLY the Dockerfile, nothing else."""
13
 
14
+ response = client.text_generation(
15
+ prompt,
16
+ max_new_tokens=800,
17
+ temperature=0.3
 
 
 
 
 
 
 
18
  )
19
+ return response
20
 
21
  demo = gr.Interface(
22
  fn=generate_dockerfile,
 
27
  ],
28
  outputs=gr.Code(language="dockerfile", label="Generated Dockerfile"),
29
  title="🐳 DevOps Dockerfile Generator",
30
+ description="Generate production-ready Dockerfiles using FREE AI!"
31
  )
32
 
33
  demo.launch()