Update app.py
Browse files
app.py
CHANGED
@@ -40,12 +40,12 @@ def invoke(prompt):
|
|
40 |
modelId = config["model"]
|
41 |
accept = "application/json"
|
42 |
contentType = "application/json"
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
return "🛑 Execution is commented out. To view the source code see https://huggingface.co/spaces/bstraehle/amazon-bedrock-llm/tree/main."
|
49 |
|
50 |
description = """<a href='https://www.gradio.app/'>Gradio</a> UI using <a href='https://aws.amazon.com/bedrock/'>Amazon Bedrock</a> API
|
51 |
with <a href='https://www.anthropic.com/'>Anthropic</a> Claude 2 foundation model.
|
|
|
40 |
modelId = config["model"]
|
41 |
accept = "application/json"
|
42 |
contentType = "application/json"
|
43 |
+
response = bedrock_runtime.invoke_model(body = body, modelId = modelId, accept = accept, contentType = contentType)
|
44 |
+
response_body = json.loads(response.get("body").read())
|
45 |
+
completion = response_body["completion"]
|
46 |
+
wandb_log(prompt, completion)
|
47 |
+
return completion
|
48 |
+
#return "🛑 Execution is commented out. To view the source code see https://huggingface.co/spaces/bstraehle/amazon-bedrock-llm/tree/main."
|
49 |
|
50 |
description = """<a href='https://www.gradio.app/'>Gradio</a> UI using <a href='https://aws.amazon.com/bedrock/'>Amazon Bedrock</a> API
|
51 |
with <a href='https://www.anthropic.com/'>Anthropic</a> Claude 2 foundation model.
|