包括画卡通画,找出2张图片的相似度,电脑做梦的图片生成,利用GTP-2的文本续写。

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DeepAI;
namespace WpfApp7
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent(); } void TestCartoon() { // Ensure your DeepAI.Client NuGet package is up to date: https://www.nuget.org/packages/DeepAI.Client
// Example posting a image URL: // using DeepAI; // Add this line to the top of your file //DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); //StandardApiResponse resp = api.callStandardApi("toonify", new
//{
// image = "YOUR_IMAGE_URL",
//});
//Console.Write(api.objectAsJsonString(resp)); // Example posting a local image file: // using DeepAI; // Add this line to the top of your file DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); StandardApiResponse resp = api.callStandardApi("toonify", new
{
image = File.OpenRead(@"C:\Users\gwang\Pictures\1469162215-how-to-read-faces.jpg"),
}); Console.Write(api.objectAsJsonString(resp)); } void TestSearchSimil2Image() { //DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); //StandardApiResponse resp = api.callStandardApi("image-similarity", new
//{
// image1 = "YOUR_IMAGE_URL",
// image2 = "YOUR_IMAGE_URL",
//});
//Console.Write(api.objectAsJsonString(resp)); // Example posting a local image file: DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); StandardApiResponse resp = api.callStandardApi("image-similarity", new
{
image1 = File.OpenRead("C:\\path\\to\\your\\file.jpg"),
image2 = File.OpenRead("C:\\path\\to\\your\\file.jpg"),
});
Console.Write(api.objectAsJsonString(resp)); } void TestDeepDream() { // Ensure your DeepAI.Client NuGet package is up to date: https://www.nuget.org/packages/DeepAI.Client
// Example posting a image URL: //using DeepAI; // Add this line to the top of your file //DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); //StandardApiResponse resp = api.callStandardApi("deepdream", new
//{
// image = "YOUR_IMAGE_URL",
//});
//Console.Write(api.objectAsJsonString(resp)); // Example posting a local image file: // using DeepAI; // Add this line to the top of your file DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); StandardApiResponse resp = api.callStandardApi("deepdream", new
{
image = File.OpenRead(@"C:\Users\gwang\Pictures\1469162215-how-to-read-faces.jpg"),
});
Console.Write(api.objectAsJsonString(resp)); } void TestTextGeneration() { //https://deepai.org/machine-learning-model/text-generator
// Text Generation Csharp Examples
// Ensure your DeepAI.Client NuGet package is up to date: https://www.nuget.org/packages/DeepAI.Client
// Example posting a text URL: // using DeepAI; // Add this line to the top of your file //DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); //StandardApiResponse resp = api.callStandardApi("text-generator", new
//{
// text = "YOUR_TEXT_URL",
//});
//Console.Write(api.objectAsJsonString(resp)); // Example posting a local text file: //using DeepAI; // Add this line to the top of your file //DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); //StandardApiResponse resp = api.callStandardApi("text-generator", new
//{
// text = File.OpenRead("C:\\path\\to\\your\\file.txt"),
//});
//Console.Write(api.objectAsJsonString(resp)); //// Example directly sending a text string: //using DeepAI; // Add this line to the top of your file DeepAI_API api = new DeepAI_API(apiKey: "quickstart-QUdJIGlzIGNvbWluZy4uLi4K"); StandardApiResponse resp = api.callStandardApi("text-generator", new
{
text = "Three days into the Tokyo 2020 Games, 20 sports will be contested today",
});
Console.Write(api.objectAsJsonString(resp)); } private void Button_Click(object sender, RoutedEventArgs e)
{
TestTextGeneration();
// TestDeepDream ();
} } }

  

c# 调用DeepAI的更多相关文章

  1. 黑马毕向东Java基础知识总结

    Java基础知识总结(超级经典) 转自:百度文库 黑马毕向东JAVA基础总结笔记    侵删! 写代码: 1,明确需求.我要做什么? 2,分析思路.我要怎么做?1,2,3. 3,确定步骤.每一个思路部 ...

  2. 《果壳中的C# C# 5.0 权威指南》 - 学习笔记

    <果壳中的C# C# 5.0 权威指南> ========== ========== ==========[作者] (美) Joseph Albahari (美) Ben Albahari ...

  3. JS调用Android、Ios原生控件

    在上一篇博客中已经和大家聊了,关于JS与Android.Ios原生控件之间相互通信的详细代码实现,今天我们一起聊一下JS调用Android.Ios通信的相同点和不同点,以便帮助我们在进行混合式开发时, ...

  4. 【原创分享·支付宝支付】HBuilder打包APP调用支付宝客户端支付

    前言 最近有点空余时间,所以,就研究了一下APP支付.前面很早就搞完APP的微信支付了,但是由于时间上和应用上的情况,支付宝一直没空去研究.然后等我空了的时候,发现支付宝居然升级了支付逻辑,虽然目前还 ...

  5. 操作系统篇-调用门与特权级(CPL、DPL和RPL)

    || 版权声明:本文为博主原创文章,未经博主允许不得转载. 一.前言 在前两篇文章(<操作系统篇-浅谈实模式与保护模式>和<操作系统篇-分段机制与GDT|LDT>)中,我们提到 ...

  6. 架构设计:远程调用服务架构设计及zookeeper技术详解(下篇)

    一.下篇开头的废话 终于开写下篇了,这也是我写远程调用框架的第三篇文章,前两篇都被博客园作为[编辑推荐]的文章,很兴奋哦,嘿嘿~~~~,本人是个很臭美的人,一定得要截图为证: 今天是2014年的第一天 ...

  7. django server之间通过remote user 相互调用

    首先,场景是这样的:存在两个django web应用,并且两个应用存在一定的联系.某些情况下彼此需要获取对方的数据. 但是我们的应用肯经都会有对应的鉴权机制.不会让人家随随便便就访问的对吧.好比上车要 ...

  8. 调用AJAX做登陆和注册

    先建立一个页面来检测一下我们建立的用户名能不能用,看一下有没有已经存在的用户名吗 可以通过ajax提示一下 $("#uid").blur(function(){ //取用户名 va ...

  9. nodejs进阶(2)—函数模块调用

    函数调用 1. 文件内普通函数调用 创建一个js文件命名为2_callFunction.js,其中定义一个函数fun1,向返回对象输出了一段字符串“你好,我是fun1”. //------------ ...

  10. 【初学python】使用python调用monkey测试

    目前公司主要开发安卓平台的APP,平时测试经常需要使用monkey测试,所以尝试了下用python调用monkey,代码如下: import os apk = {'j': 'com.***.test1 ...

随机推荐

  1. 0基础读顶会论文—Kappa:一种用于无服务器计算的编程框架

    原文链接 代码:快速使用kappa 首先的首先,可以先去了解一下lambda架构 Abstract 在本文中提出了Kappa,一个简化无服务器开发的框架.它使用检查点来处理lambda函数超时,并提供 ...

  2. UIAbility组件生命周期

    当用户打开.切换和返回到对应应用时,应用中的UIAbility实例会在其生命周期的不同状态之间转换.UIAbility类提供了一系列回调,通过这些回调可以知道当前UIAbility实例的某个状态发生改 ...

  3. 14-8 C++函数调用运算符

    目录 14.8.0 引入 函数对象 含有状态的函数对象 函数对象常做泛型算法实参 14.8.1 lambda是函数对象 表示没有捕获值的lambda的类 表示lambda及其捕获行为的类 14.8.2 ...

  4. .NET 创建动态方法方案及 Natasha V9

    前言 本篇文章前面客观评估了 .NET 创建动态方方案多个方面的优劣,后半部分是 Natasha V9 的新版特性. .NET 中创建动态方法的方案 创建动态方法的不同选择 以下陈列了几种创建动态方法 ...

  5. [昌哥IT课堂]使用MySQL Shell 部署沙盒数据库实例详解

    概述:这部分解释了如何使用AdminAPI设置沙盒部署.部署和使用本地MySQL的沙盒实例是开始探索AdminAPI的好方法.在将功能部署到生产服务器之前,您可以在本地测试功能.AdminAPI具有内 ...

  6. 基于antlr的表达式解析器——函数类型验证

    package daicy.formula.evaluator; import java.util.HashMap; import java.util.Map; import org.antlr.ru ...

  7. golang之go-spew

    github: https://github.com/davecgh/go-spew 我们在使用Golang(Go语言)开发的过程中,会通过经常通过调试的方式查找问题的原因,解决问题,尤其是当遇到一个 ...

  8. Golang框架之gin

    gin是目前golang的主要web框架之一,之所以选择这个框架是因为其拥有高效的路由性能,并且有人长期维护,目前github上的star数已经破3W. [安装] go get -u github.c ...

  9. Tornado框架之应用安全(四)

    知识点 Cookie操作 安全Cookie 跨站请求伪造原理 XSRF保护 模板 请求体 HTTP报文头 用户验证 authenticated装饰器 get_current_user()方法 logi ...

  10. clickhouse之python操作

    官网:https://clickhouse-driver.readthedocs.io/en/latest/ 使用python来对clickhouse进行操作 安装) pip install clic ...