This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import requests | |
import zipfile | |
import os | |
import imageio as iio | |
def convert_dcm_jpeg(dir): | |
files = os.listdir(dir) | |
for i in files: | |
print(i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'); | |
const getToken = () => { | |
return new Promise((resolve, reject) => { | |
const apikey = 'APIKEY do WML'; | |
request(`https://iam.bluemix.net/oidc/token`, { | |
method: 'POST', | |
headers: { | |
"Content-Type": "application/x-www-form-urlencoded", | |
Authorization: "Basic " + btoa("bx:bx") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TG = require('telegram-bot-api'); | |
const AssistantV2 = require('ibm-watson/assistant/v2'); | |
const { IamAuthenticator } = require('ibm-watson/auth'); | |
const assistant = new AssistantV2({ | |
version: '2020-04-01', | |
authenticator: new IamAuthenticator({ | |
apikey: process.env.ASSISTANT_APIKEY | |
}), | |
serviceUrl: process.env.ASSISTANT_URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WML_API = 'SUA_APIKEY_WML' | |
wml_url = 'URL_SCORE_MODELO' | |
def getToken(): | |
header = { | |
"Content-Type": "application/x-www-form-urlencoded", | |
'Authorization': 'Basic Yng6Yng=' | |
} | |
payload = 'apikey={}&grant_type=urn:ibm:params:oauth:grant-type:apikey'.format(WML_API) | |
req = requests.post('https://iam.bluemix.net/oidc/token', data=payload, headers=header) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3-slim | |
WORKDIR /home/app | |
COPY . /home/app | |
RUN pip install -r requirements.txt | |
EXPOSE 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use actix_web::{get, post, web, App, HttpResponse, HttpServer, Responder}; | |
#[get("/")] | |
async fn hello() -> impl Responder { | |
HttpResponse::Ok().body("Hello world!") | |
} | |
#[post("/echo")] | |
async fn echo(req_body: String) -> impl Responder { | |
HttpResponse::Ok().body(req_body) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mqtt = require('mqtt'); | |
var client = mqtt.connect('mqtt://endereco', {port: port, username: 'username', password: 'password'}) | |
client.on('connect', function () { | |
client.on('message', (t, b) => { | |
console.log(b.toString()) | |
}) | |
}) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require('node-fetch'); | |
const getToken = () => { | |
return new Promise((resolve, reject) => { | |
const apikey = 'APIKEY do WML'; | |
fetch(`https://iam.bluemix.net/oidc/token`, { | |
method: 'POST', | |
headers: { | |
"Content-Type": "application/x-www-form-urlencoded", | |
Authorization: "Basic " + btoa("bx:bx") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg.payload.data = new Date() | |
return msg; | |
if (msg.payload) { | |
let output = msg.payload.output.generic; | |
msg.payload = { messages: [] }; | |
msg.payload.session = msg.payload.session_id | |
for (var i = 0; i < output.length; i++) { | |
if (output[i].response_type === "text") { |