Update app.py
Browse files
app.py
CHANGED
@@ -31,19 +31,20 @@ def invoke(prompt):
|
|
31 |
completion = ""
|
32 |
|
33 |
try:
|
34 |
-
model_id = config["model"]
|
35 |
-
model_kwargs = {
|
36 |
-
"max_tokens": 2048, "temperature": 0.1,
|
37 |
-
"top_k": 250, "top_p": 1, "stop_sequences": ["\n\nHuman"],
|
38 |
-
}
|
39 |
-
# Input configuration
|
40 |
-
prompt = "What is a trullo?"
|
41 |
body = {
|
42 |
"anthropic_version": "bedrock-2023-05-31",
|
43 |
-
"system": "You are a honest and helpful bot.",
|
44 |
"messages": [
|
45 |
{"role": "user", "content": [{"type": "text", "text": prompt}]},
|
46 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
body.update(model_kwargs)
|
49 |
|
@@ -60,7 +61,7 @@ def invoke(prompt):
|
|
60 |
return completion
|
61 |
|
62 |
description = """<a href='https://www.gradio.app/'>Gradio</a> UI using the <a href='https://aws.amazon.com/bedrock/'>Amazon Bedrock</a> SDK
|
63 |
-
with <a href='https://www.anthropic.com/'>Anthropic</a> Claude model."""
|
64 |
|
65 |
gr.close_all()
|
66 |
|
|
|
31 |
completion = ""
|
32 |
|
33 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
body = {
|
35 |
"anthropic_version": "bedrock-2023-05-31",
|
|
|
36 |
"messages": [
|
37 |
{"role": "user", "content": [{"type": "text", "text": prompt}]},
|
38 |
],
|
39 |
+
"system": "You are a honest, helpful, and harmless bot."
|
40 |
+
}
|
41 |
+
model_id = config["model"]
|
42 |
+
model_kwargs = {
|
43 |
+
"max_tokens": 2048,
|
44 |
+
"stop_sequences": ["\n\nHuman"],
|
45 |
+
"temperature": 0.1,
|
46 |
+
"top_k": 250,
|
47 |
+
"top_p": 1
|
48 |
}
|
49 |
body.update(model_kwargs)
|
50 |
|
|
|
61 |
return completion
|
62 |
|
63 |
description = """<a href='https://www.gradio.app/'>Gradio</a> UI using the <a href='https://aws.amazon.com/bedrock/'>Amazon Bedrock</a> SDK
|
64 |
+
with <a href='https://www.anthropic.com/'>Anthropic</a> Claude 3 model."""
|
65 |
|
66 |
gr.close_all()
|
67 |
|